Add toggles: disable_workgroup_init, disable_symbol_renaming
--disable_workgroup_init will disable the workgroup memory zero initiailization. Useful for benchmarking. --disable_symbol_renaming will disable tint's symbol renamer. Useful for debugging output. Bug: tint:1003 Fixed: dawn:1016 Change-Id: I92486ef88a2c1112d9ccb40f7920947bd2011c70 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/58861 Commit-Queue: Ben Clayton <bclayton@google.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
18f63b4e16
commit
909a3c3ccf
|
@ -204,6 +204,14 @@ namespace dawn_native {
|
||||||
"testing Tint's SPIRV->WGSL translation on real content to be sure that it will "
|
"testing Tint's SPIRV->WGSL translation on real content to be sure that it will "
|
||||||
"work when the same translation runs in a WASM module in the page.",
|
"work when the same translation runs in a WASM module in the page.",
|
||||||
"https://crbug.com/dawn/960"}},
|
"https://crbug.com/dawn/960"}},
|
||||||
|
{Toggle::DisableWorkgroupInit,
|
||||||
|
{"disable_workgroup_init",
|
||||||
|
"Disables the workgroup memory zero-initialization for compute shaders.",
|
||||||
|
"https://crbug.com/tint/1003"}},
|
||||||
|
{Toggle::DisableSymbolRenaming,
|
||||||
|
{"disable_symbol_renaming",
|
||||||
|
"Disables the WGSL symbol renaming so that names are preserved.",
|
||||||
|
"https://crbug.com/dawn/1016"}},
|
||||||
// Dummy comment to separate the }} so it is clearer what to copy-paste to add a toggle.
|
// Dummy comment to separate the }} so it is clearer what to copy-paste to add a toggle.
|
||||||
}};
|
}};
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
|
@ -56,6 +56,8 @@ namespace dawn_native {
|
||||||
DumpShaders,
|
DumpShaders,
|
||||||
DEPRECATED_DumpTranslatedShaders, // Use DumpShaders
|
DEPRECATED_DumpTranslatedShaders, // Use DumpShaders
|
||||||
ForceWGSLStep,
|
ForceWGSLStep,
|
||||||
|
DisableWorkgroupInit,
|
||||||
|
DisableSymbolRenaming,
|
||||||
|
|
||||||
EnumCount,
|
EnumCount,
|
||||||
InvalidEnum = EnumCount,
|
InvalidEnum = EnumCount,
|
||||||
|
|
|
@ -260,6 +260,12 @@ namespace dawn_native { namespace d3d12 {
|
||||||
transformManager.Add<tint::transform::BindingRemapper>();
|
transformManager.Add<tint::transform::BindingRemapper>();
|
||||||
transformManager.Add<tint::transform::Renamer>();
|
transformManager.Add<tint::transform::Renamer>();
|
||||||
|
|
||||||
|
if (GetDevice()->IsToggleEnabled(Toggle::DisableSymbolRenaming)) {
|
||||||
|
// We still need to rename HLSL reserved keywords
|
||||||
|
transformInputs.Add<tint::transform::Renamer::Config>(
|
||||||
|
tint::transform::Renamer::Target::kHlslKeywords);
|
||||||
|
}
|
||||||
|
|
||||||
// D3D12 registers like `t3` and `c3` have the same bindingOffset number in the
|
// D3D12 registers like `t3` and `c3` have the same bindingOffset number in the
|
||||||
// remapping but should not be considered a collision because they have different types.
|
// remapping but should not be considered a collision because they have different types.
|
||||||
const bool mayCollide = true;
|
const bool mayCollide = true;
|
||||||
|
@ -284,15 +290,21 @@ namespace dawn_native { namespace d3d12 {
|
||||||
|
|
||||||
if (auto* data = transformOutputs.Get<tint::transform::Renamer::Data>()) {
|
if (auto* data = transformOutputs.Get<tint::transform::Renamer::Data>()) {
|
||||||
auto it = data->remappings.find(entryPointName);
|
auto it = data->remappings.find(entryPointName);
|
||||||
if (it == data->remappings.end()) {
|
if (it != data->remappings.end()) {
|
||||||
return DAWN_VALIDATION_ERROR("Could not find remapped name for entry point.");
|
*remappedEntryPointName = it->second;
|
||||||
|
} else {
|
||||||
|
if (GetDevice()->IsToggleEnabled(Toggle::DisableSymbolRenaming)) {
|
||||||
|
*remappedEntryPointName = entryPointName;
|
||||||
|
} else {
|
||||||
|
return DAWN_VALIDATION_ERROR("Could not find remapped name for entry point.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*remappedEntryPointName = it->second;
|
|
||||||
} else {
|
} else {
|
||||||
return DAWN_VALIDATION_ERROR("Transform output missing renamer data.");
|
return DAWN_VALIDATION_ERROR("Transform output missing renamer data.");
|
||||||
}
|
}
|
||||||
|
|
||||||
tint::writer::hlsl::Options options;
|
tint::writer::hlsl::Options options;
|
||||||
|
options.disable_workgroup_init = GetDevice()->IsToggleEnabled(Toggle::DisableWorkgroupInit);
|
||||||
auto result = tint::writer::hlsl::Generate(&program, options);
|
auto result = tint::writer::hlsl::Generate(&program, options);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
errorStream << "Generator: " << result.error << std::endl;
|
errorStream << "Generator: " << result.error << std::endl;
|
||||||
|
|
|
@ -125,6 +125,13 @@ namespace dawn_native { namespace metal {
|
||||||
transformManager.Add<tint::transform::BindingRemapper>();
|
transformManager.Add<tint::transform::BindingRemapper>();
|
||||||
transformManager.Add<tint::transform::Renamer>();
|
transformManager.Add<tint::transform::Renamer>();
|
||||||
|
|
||||||
|
if (GetDevice()->IsToggleEnabled(Toggle::DisableSymbolRenaming)) {
|
||||||
|
// We still need to rename MSL reserved keywords
|
||||||
|
transformInputs.Add<tint::transform::Renamer::Config>(
|
||||||
|
tint::transform::Renamer::Target::kMslKeywords);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
transformInputs.Add<BindingRemapper::Remappings>(std::move(bindingPoints),
|
transformInputs.Add<BindingRemapper::Remappings>(std::move(bindingPoints),
|
||||||
std::move(accessControls),
|
std::move(accessControls),
|
||||||
/* mayCollide */ true);
|
/* mayCollide */ true);
|
||||||
|
@ -136,10 +143,15 @@ namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
if (auto* data = transformOutputs.Get<tint::transform::Renamer::Data>()) {
|
if (auto* data = transformOutputs.Get<tint::transform::Renamer::Data>()) {
|
||||||
auto it = data->remappings.find(entryPointName);
|
auto it = data->remappings.find(entryPointName);
|
||||||
if (it == data->remappings.end()) {
|
if (it != data->remappings.end()) {
|
||||||
return DAWN_VALIDATION_ERROR("Could not find remapped name for entry point.");
|
*remappedEntryPointName = it->second;
|
||||||
|
} else {
|
||||||
|
if (GetDevice()->IsToggleEnabled(Toggle::DisableSymbolRenaming)) {
|
||||||
|
*remappedEntryPointName = entryPointName;
|
||||||
|
} else {
|
||||||
|
return DAWN_VALIDATION_ERROR("Could not find remapped name for entry point.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*remappedEntryPointName = it->second;
|
|
||||||
} else {
|
} else {
|
||||||
return DAWN_VALIDATION_ERROR("Transform output missing renamer data.");
|
return DAWN_VALIDATION_ERROR("Transform output missing renamer data.");
|
||||||
}
|
}
|
||||||
|
@ -147,6 +159,7 @@ namespace dawn_native { namespace metal {
|
||||||
tint::writer::msl::Options options;
|
tint::writer::msl::Options options;
|
||||||
options.buffer_size_ubo_index = kBufferLengthBufferSlot;
|
options.buffer_size_ubo_index = kBufferLengthBufferSlot;
|
||||||
options.fixed_sample_mask = sampleMask;
|
options.fixed_sample_mask = sampleMask;
|
||||||
|
options.disable_workgroup_init = GetDevice()->IsToggleEnabled(Toggle::DisableWorkgroupInit);
|
||||||
auto result = tint::writer::msl::Generate(&program, options);
|
auto result = tint::writer::msl::Generate(&program, options);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
errorStream << "Generator: " << result.error << std::endl;
|
errorStream << "Generator: " << result.error << std::endl;
|
||||||
|
|
|
@ -85,6 +85,8 @@ namespace dawn_native { namespace opengl {
|
||||||
// generate SPIRV and SPIRV-Cross reflection data to be used in this backend.
|
// generate SPIRV and SPIRV-Cross reflection data to be used in this backend.
|
||||||
if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) {
|
if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) {
|
||||||
tint::writer::spirv::Options options;
|
tint::writer::spirv::Options options;
|
||||||
|
options.disable_workgroup_init =
|
||||||
|
GetDevice()->IsToggleEnabled(Toggle::DisableWorkgroupInit);
|
||||||
auto result = tint::writer::spirv::Generate(GetTintProgram(), options);
|
auto result = tint::writer::spirv::Generate(GetTintProgram(), options);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
std::ostringstream errorStream;
|
std::ostringstream errorStream;
|
||||||
|
|
|
@ -108,6 +108,8 @@ namespace dawn_native { namespace vulkan {
|
||||||
|
|
||||||
tint::writer::spirv::Options options;
|
tint::writer::spirv::Options options;
|
||||||
options.emit_vertex_point_size = true;
|
options.emit_vertex_point_size = true;
|
||||||
|
options.disable_workgroup_init =
|
||||||
|
GetDevice()->IsToggleEnabled(Toggle::DisableWorkgroupInit);
|
||||||
auto result = tint::writer::spirv::Generate(&program, options);
|
auto result = tint::writer::spirv::Generate(&program, options);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
errorStream << "Generator: " << result.error << std::endl;
|
errorStream << "Generator: " << result.error << std::endl;
|
||||||
|
@ -213,6 +215,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
|
|
||||||
tint::writer::spirv::Options options;
|
tint::writer::spirv::Options options;
|
||||||
options.emit_vertex_point_size = true;
|
options.emit_vertex_point_size = true;
|
||||||
|
options.disable_workgroup_init = GetDevice()->IsToggleEnabled(Toggle::DisableWorkgroupInit);
|
||||||
auto result = tint::writer::spirv::Generate(&program, options);
|
auto result = tint::writer::spirv::Generate(&program, options);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
errorStream << "Generator: " << result.error << std::endl;
|
errorStream << "Generator: " << result.error << std::endl;
|
||||||
|
|
Loading…
Reference in New Issue