Mesa (main): aco/tests: implement sub-dword program inputs
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Feb 3 16:21:09 UTC 2022
Module: Mesa
Branch: main
Commit: 27f1f5537d4c7ff1cb753e19dbd885924f25be8f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=27f1f5537d4c7ff1cb753e19dbd885924f25be8f
Author: Rhys Perry <pendingchaos02 at gmail.com>
Date: Thu Jan 27 14:18:04 2022 +0000
aco/tests: implement sub-dword program inputs
Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14810>
---
src/amd/compiler/tests/helpers.cpp | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/amd/compiler/tests/helpers.cpp b/src/amd/compiler/tests/helpers.cpp
index 0b9ce051271..fd18ee2cd21 100644
--- a/src/amd/compiler/tests/helpers.cpp
+++ b/src/amd/compiler/tests/helpers.cpp
@@ -113,11 +113,21 @@ bool setup_cs(const char *input_spec, enum chip_class chip_class,
create_program(chip_class, compute_cs, wave_size, family);
if (input_spec) {
- unsigned num_inputs = DIV_ROUND_UP(strlen(input_spec), 3u);
- aco_ptr<Instruction> startpgm{create_instruction<Pseudo_instruction>(aco_opcode::p_startpgm, Format::PSEUDO, 0, num_inputs)};
- for (unsigned i = 0; i < num_inputs; i++) {
- RegClass cls(input_spec[i * 3] == 'v' ? RegType::vgpr : RegType::sgpr, input_spec[i * 3 + 1] - '0');
- inputs[i] = bld.tmp(cls);
+ std::vector<RegClass> input_classes;
+ while (input_spec[0]) {
+ RegType type = input_spec[0] == 'v' ? RegType::vgpr : RegType::sgpr;
+ unsigned size = input_spec[1] - '0';
+ bool in_bytes = input_spec[2] == 'b';
+ input_classes.push_back(RegClass::get(type, size * (in_bytes ? 1 : 4)));
+
+ input_spec += 2 + in_bytes;
+ while (input_spec[0] == ' ') input_spec++;
+ }
+
+ aco_ptr<Instruction> startpgm{create_instruction<Pseudo_instruction>(
+ aco_opcode::p_startpgm, Format::PSEUDO, 0, input_classes.size())};
+ for (unsigned i = 0; i < input_classes.size(); i++) {
+ inputs[i] = bld.tmp(input_classes[i]);
startpgm->definitions[i] = Definition(inputs[i]);
}
bld.insert(std::move(startpgm));
More information about the mesa-commit
mailing list