Fix gfx9 trap handler to retrieve correct return address
The trap protocol changed between gfx8 and gfx9. The return address
is in trap temporaries [0,1] on gfx9 rather than [4,5] on gfx8.
Unfortunately SP3 changes the meaning of the ttmp register aliases
in gfx9, further confusing the issue.
Clean up later when LLVM assembly build is introduced to the runtime.
Change-Id: I84ea9bf3736f060dd95d0361f9d5a0f9a3576178
[ROCm/ROCR-Runtime commit: f0a1c7c4c6]
This commit is contained in:
@@ -175,20 +175,34 @@ void GpuAgent::AssembleShader(const char* src_sp3, const char* func_name,
|
||||
struct CompiledShader {
|
||||
ASICShader compute_7;
|
||||
ASICShader compute_8;
|
||||
ASICShader compute_9;
|
||||
};
|
||||
|
||||
std::map<std::string, CompiledShader> compiled_shaders = {
|
||||
{"TrapHandler",
|
||||
{{NULL, 0, 0, 0}, {kCodeTrapHandler8, sizeof(kCodeTrapHandler8), 2, 4}}},
|
||||
{
|
||||
{NULL, 0, 0, 0},
|
||||
{kCodeTrapHandler8, sizeof(kCodeTrapHandler8), 2, 4},
|
||||
{kCodeTrapHandler9, sizeof(kCodeTrapHandler9), 2, 4},
|
||||
}},
|
||||
{"CopyAligned",
|
||||
{{kCodeCopyAligned7, sizeof(kCodeCopyAligned7), 32, 12},
|
||||
{kCodeCopyAligned8, sizeof(kCodeCopyAligned8), 32, 12}}},
|
||||
{
|
||||
{kCodeCopyAligned7, sizeof(kCodeCopyAligned7), 32, 12},
|
||||
{kCodeCopyAligned8, sizeof(kCodeCopyAligned8), 32, 12},
|
||||
{kCodeCopyAligned8, sizeof(kCodeCopyAligned8), 32, 12},
|
||||
}},
|
||||
{"CopyMisaligned",
|
||||
{{kCodeCopyMisaligned7, sizeof(kCodeCopyMisaligned7), 23, 10},
|
||||
{kCodeCopyMisaligned8, sizeof(kCodeCopyMisaligned8), 23, 10}}},
|
||||
{
|
||||
{kCodeCopyMisaligned7, sizeof(kCodeCopyMisaligned7), 23, 10},
|
||||
{kCodeCopyMisaligned8, sizeof(kCodeCopyMisaligned8), 23, 10},
|
||||
{kCodeCopyMisaligned8, sizeof(kCodeCopyMisaligned8), 23, 10},
|
||||
}},
|
||||
{"Fill",
|
||||
{{kCodeFill7, sizeof(kCodeFill7), 19, 8},
|
||||
{kCodeFill8, sizeof(kCodeFill8), 19, 8}}}};
|
||||
{
|
||||
{kCodeFill7, sizeof(kCodeFill7), 19, 8},
|
||||
{kCodeFill8, sizeof(kCodeFill8), 19, 8},
|
||||
{kCodeFill8, sizeof(kCodeFill8), 19, 8},
|
||||
}}};
|
||||
|
||||
auto compiled_shader_it = compiled_shaders.find(func_name);
|
||||
assert(compiled_shader_it != compiled_shaders.end() &&
|
||||
@@ -201,9 +215,11 @@ void GpuAgent::AssembleShader(const char* src_sp3, const char* func_name,
|
||||
asic_shader = &compiled_shader_it->second.compute_7;
|
||||
break;
|
||||
case 8:
|
||||
case 9: // ISA-compatible with 8
|
||||
asic_shader = &compiled_shader_it->second.compute_8;
|
||||
break;
|
||||
case 9:
|
||||
asic_shader = &compiled_shader_it->second.compute_9;
|
||||
break;
|
||||
default:
|
||||
assert(false && "Precompiled shader unavailable for target");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user