(
result: CompilationResult,
filters: ParseFiltersAndOutputOptions,
compilationInfo: CompilationInfo,
)
| 197 | } |
| 198 | |
| 199 | override async extractDeviceCode( |
| 200 | result: CompilationResult, |
| 201 | filters: ParseFiltersAndOutputOptions, |
| 202 | compilationInfo: CompilationInfo, |
| 203 | ) { |
| 204 | const {dirPath} = result; |
| 205 | const {demangle} = filters; |
| 206 | const devices = {...result.devices}; |
| 207 | if (dirPath) { |
| 208 | const files = await fs.readdir(dirPath); |
| 209 | const maxSize = this.env.ceProps('max-asm-size', 64 * 1024 * 1024); |
| 210 | await Promise.all( |
| 211 | files |
| 212 | .filter(f => f.endsWith('.ptx') || f.endsWith('.cubin')) |
| 213 | .map(async name => { |
| 214 | const type = name.endsWith('.ptx') ? 'PTX' : 'SASS'; |
| 215 | const {asm} = |
| 216 | type === 'PTX' |
| 217 | ? {asm: await fs.readFile(Path.join(dirPath, name), 'utf8')} |
| 218 | : await this.nvdisasm(Path.join(dirPath, name), {dirPath}, maxSize); |
| 219 | const archAndCode = name.split('.').slice(1, -1).join(', ') || ''; |
| 220 | const nameAndArch = type + (archAndCode ? ` (${archAndCode.toLowerCase()})` : ''); |
| 221 | const parser = type === 'PTX' ? this.ptxParser : this.deviceAsmParser; |
| 222 | Object.assign(devices, { |
| 223 | [nameAndArch]: await this.postProcessAsm( |
| 224 | { |
| 225 | okToCache: demangle, |
| 226 | ...parser.process(asm, {...filters, binary: type === 'SASS'}), |
| 227 | }, |
| 228 | {...filters, binary: type === 'SASS'}, |
| 229 | ), |
| 230 | }); |
| 231 | }), |
| 232 | ); |
| 233 | result.devices = devices; |
| 234 | } |
| 235 | return result; |
| 236 | } |
| 237 | } |
nothing calls this directly
no test coverage detected