mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 15:10:12 +01:00
clover: fix parameter arguments since recent translator changes.
The translator recently unmapped where const info gets stored, and you can ask for the metadata to be passed through instead, do that for now, until it's all resolved. Fixes: api get_kernel_arg_info Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13449>
This commit is contained in:
parent
718699b9f0
commit
9eed03657d
2 changed files with 27 additions and 11 deletions
|
|
@ -415,7 +415,11 @@ namespace {
|
|||
#undef EXT
|
||||
}
|
||||
|
||||
return SPIRV::TranslatorOpts(maximum_spirv_version, spirv_extensions);
|
||||
auto translator_opts = SPIRV::TranslatorOpts(maximum_spirv_version, spirv_extensions);
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
translator_opts.setPreserveOCLKernelArgTypeMetadataThroughString(true);
|
||||
#endif
|
||||
return translator_opts;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ namespace {
|
|||
std::unordered_map<SpvId, std::string> names;
|
||||
std::unordered_map<SpvId, cl_kernel_arg_type_qualifier> qualifiers;
|
||||
std::unordered_map<std::string, std::vector<std::string> > param_type_names;
|
||||
std::unordered_map<std::string, std::vector<std::string> > param_qual_names;
|
||||
|
||||
while (i < length) {
|
||||
const auto inst = &source[i * sizeof(uint32_t)];
|
||||
|
|
@ -176,17 +177,25 @@ namespace {
|
|||
case SpvOpString: {
|
||||
// SPIRV-LLVM-Translator stores param type names as OpStrings
|
||||
std::string str(source.data() + (i + 2u) * sizeof(uint32_t));
|
||||
if (str.find("kernel_arg_type.") != 0)
|
||||
break;
|
||||
if (str.find("kernel_arg_type.") == 0) {
|
||||
std::string line;
|
||||
std::istringstream istream(str.substr(16));
|
||||
|
||||
std::string line;
|
||||
std::istringstream istream(str.substr(16));
|
||||
std::getline(istream, line, '.');
|
||||
|
||||
std::getline(istream, line, '.');
|
||||
std::string k = line;
|
||||
while (std::getline(istream, line, ','))
|
||||
param_type_names[k].push_back(line);
|
||||
} else if (str.find("kernel_arg_type_qual.") == 0) {
|
||||
std::string line;
|
||||
std::istringstream istream(str.substr(21));
|
||||
|
||||
std::string k = line;
|
||||
while (std::getline(istream, line, ','))
|
||||
param_type_names[k].push_back(line);
|
||||
std::getline(istream, line, '.');
|
||||
std::string k = line;
|
||||
while (std::getline(istream, line, ','))
|
||||
param_qual_names[k].push_back(line);
|
||||
} else
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -492,13 +501,16 @@ namespace {
|
|||
break;
|
||||
}
|
||||
|
||||
case SpvOpFunctionEnd:
|
||||
case SpvOpFunctionEnd: {
|
||||
if (kernel_name.empty())
|
||||
break;
|
||||
|
||||
for (size_t i = 0; i < param_type_names[kernel_name].size(); i++)
|
||||
args[i].info.type_name = param_type_names[kernel_name][i];
|
||||
|
||||
for (size_t i = 0; i < param_qual_names[kernel_name].size(); i++)
|
||||
if (param_qual_names[kernel_name][i].find("const") != std::string::npos)
|
||||
args[i].info.type_qualifier |= CL_KERNEL_ARG_TYPE_CONST;
|
||||
b.syms.emplace_back(kernel_name, detokenize(attributes, " "),
|
||||
req_local_size, 0, kernel_nb, args);
|
||||
++kernel_nb;
|
||||
|
|
@ -506,7 +518,7 @@ namespace {
|
|||
args.clear();
|
||||
attributes.clear();
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue