1 parent
0205f870db
commit
00a9e95de9
3 files changed
+143
-6
No files matched your search
@@ -266,6 +266,8 @@ const cudaKernels = async (
|
||||
rejectGpu("CUBIN symbol string table is invalid");
|
||||
const names = await sectionBytes(source, namesSection!, index.budget);
|
||||
const bytes = await sectionBytes(source, section, index.budget);
|
||||
const symbolCount = bytes.length / width;
|
||||
let extendedIndices: Buffer | null = null;
|
||||
for (let offset = 0; offset < bytes.length; offset += width) {
|
||||
index.budget.visit();
|
||||
const symbol = readElfSymbol(
|
||||
@@ -275,7 +277,31 @@ const cudaKernels = async (
|
||||
);
|
||||
// STO_CUDA_ENTRY distinguishes launchable kernels from ordinary device functions.
|
||||
if (symbol.type !== 2 || (symbol.other & 0x10) === 0) continue;
|
||||
const text = directory.sections[symbol.section_index];
|
||||
let sectionIndex = symbol.section_index;
|
||||
if (sectionIndex === 0xffff) {
|
||||
if (extendedIndices === null) {
|
||||
const matches = directory.sections.filter(
|
||||
(row) => row.type === 18 && row.link === section.index,
|
||||
);
|
||||
if (matches.length !== 1)
|
||||
rejectGpu(
|
||||
"CUBIN extended symbol section-index table is unavailable",
|
||||
);
|
||||
const extended = matches[0]!;
|
||||
if (
|
||||
extended.entry_size !== 4n ||
|
||||
extended.size !== BigInt(symbolCount) * 4n
|
||||
)
|
||||
rejectGpu(
|
||||
"CUBIN extended symbol section-index table has an invalid extent",
|
||||
);
|
||||
extendedIndices = await sectionBytes(source, extended, index.budget);
|
||||
}
|
||||
sectionIndex = new BinaryReader(extendedIndices, directory.little).u32(
|
||||
(offset / width) * 4,
|
||||
);
|
||||
}
|
||||
const text = directory.sections[sectionIndex];
|
||||
if (text === undefined || text.type !== 1 || (text.flags & 4n) === 0n)
|
||||
rejectGpu("CUBIN kernel symbol has no executable section");
|
||||
const kernel = blankKernel(
|
||||
|
||||
Reference in new issue
Block a user