mirror of
https://github.com/morluto/rea.git
synced 2026-10-26 17:35:11 +00:00
fix(gpu): accept PTX compute target aliases
Preserve the source spelling of NVIDIA's documented compute_xx target synonym. Fixes #6494
This commit is contained in:
1 parent
2dfcc6463b
commit
f250c8cca5
3 files changed
+22
-1
No files matched your search
@@ -81,6 +81,8 @@ Kernel representations have different meanings:
|
||||
- PTX reports parameter declarations and virtual registers. Shared bytes cover
|
||||
supported static declarations inside that entry; they do not establish module
|
||||
shared memory, dynamic allocation or physical device resources.
|
||||
A `.target compute_xx` spelling is retained as written; NVIDIA PTX defines it
|
||||
as a synonym for `.target sm_xx`.
|
||||
Scalar register declarations count each bare or percent-prefixed name and
|
||||
each parameterized range. Unsupported declaration forms or overflowing totals
|
||||
retain an unknown count and partial decoding coverage. Unsupported parameter
|
||||
|
||||
@@ -406,7 +406,7 @@ export const readPtxTarget = (text: string): string | null => {
|
||||
if (token.value === ".target") {
|
||||
const value = stream.next();
|
||||
target =
|
||||
!value.done && /^sm_[0-9]+[a-z]?$/u.test(value.value.value)
|
||||
!value.done && /^(?:sm|compute)_[0-9]+[a-z]?$/u.test(value.value.value)
|
||||
? value.value.value
|
||||
: null;
|
||||
}
|
||||
|
||||
@@ -111,6 +111,25 @@ cliTest(
|
||||
},
|
||||
);
|
||||
|
||||
cliTest("accepts the PTX compute_xx .target synonym verbatim", async ({ cli }) => {
|
||||
const root = await createTestTempDirectory("rea-ptx-target-cli-");
|
||||
const text = `.version 8.8\n.target compute_80\n.address_size 64\n.entry kernel() {\nret;\n}\n`;
|
||||
const path = join(root, "target.ptx");
|
||||
await writeFile(path, text);
|
||||
const response = await cli.run({
|
||||
arguments: ["inspect-gpu-code-objects", path, "--json"],
|
||||
});
|
||||
expect(response.exitCode, response.stderr).toBe(0);
|
||||
const evidence = parseEvidence(
|
||||
toolContract("inspect_gpu_code_objects").outputSchema.parse(response.json),
|
||||
);
|
||||
const report = gpuCodeObjectsSchema.parse(evidence.normalized_result);
|
||||
expect(report.objects[0]!.target).toBe("compute_80");
|
||||
expect(report.ptx_artifacts[0]!.sha256).toBe(
|
||||
createHash("sha256").update(text).digest("hex"),
|
||||
);
|
||||
});
|
||||
|
||||
cliTest(
|
||||
"attributes malformed selector JSON to its actual CLI option",
|
||||
async ({ cli }) => {
|
||||
|
||||
Reference in new issue
Block a user