#asahi-gpu · 2021-03-21 11:24
bloomdougall: not that I'm discouraging more r/e, but fast sin/cos is surprisingly uninteresting on GPUs#asahi-gpu · 2021-03-21 11:24
bloomdougall: not that I'm discouraging more r/e, but fast sin/cos is surprisingly uninteresting on GPUs#asahi-gpu · 2021-03-21 06:01
dougallhmm, not that springs to mind... maybe the instructions that implement fast sin/cos, or simd-group ops like 'call/ret' and 'simd_shuffle_down'#asahi-gpu · 2021-03-21 06:01
dougallhmm, not that springs to mind... maybe the instructions that implement fast sin/cos, or simd-group ops like 'call/ret' and 'simd_shuffle_down'#asahi-gpu · 2021-03-21 04:16
DarkShadow44dougall: Is there a specific instruction where I could help fill in the gaps? As a beginner, and so.#asahi-gpu · 2021-03-21 04:16
DarkShadow44dougall: Is there a specific instruction where I could help fill in the gaps? As a beginner, and so.#asahi-gpu · 2021-03-21 02:32
DarkShadow44probably won't need the compiler snipped, since I'm using XCode#asahi-gpu · 2021-03-21 02:32
DarkShadow44probably won't need the compiler snipped, since I'm using XCode#asahi-gpu · 2021-03-21 02:31
DarkShadow44ah thanks, I kinda missed that#asahi-gpu · 2021-03-21 02:31
DarkShadow44ah thanks, I kinda missed that#asahi-gpu · 2021-03-21 02:27
dougall(command to compile it is in a comment at the top of that file - sorry if that's pointing out the obvious, but i missed it myself)#asahi-gpu · 2021-03-21 02:27
dougall(command to compile it is in a comment at the top of that file - sorry if that's pointing out the obvious, but i missed it myself)#asahi-gpu · 2021-03-21 02:26
dougallah, yeah (heh, neither of those pings worked) - I use https://github.com/Thog/gpu/blob/metallib/metal_compiler.m which calls [MTLDynamicLibrary serializeToURL:...] to generate it#asahi-gpu · 2021-03-21 02:26
dougallah, yeah (heh, neither of those pings worked) - I use https://github.com/Thog/gpu/blob/metallib/metal_compiler.m which calls [MTLDynamicLibrary serializeToURL:...] to generate it#asahi-gpu · 2021-03-21 02:22
DarkShadow44dougal: may I ask how you gor your shader-macho file?#asahi-gpu · 2021-03-21 02:22
DarkShadow44dougal: may I ask how you gor your shader-macho file?#asahi-gpu · 2021-03-21 02:22
DarkShadow44my I ask how you got your shader mdougall: acho?#asahi-gpu · 2021-03-21 02:22
DarkShadow44my I ask how you got your shader mdougall: acho?#asahi-gpu · 2021-03-21 02:21
DarkShadow44they are definitely not macho, the magic is different#asahi-gpu · 2021-03-21 02:21
DarkShadow44they are definitely not macho, the magic is different#asahi-gpu · 2021-03-21 02:21
DarkShadow44hm, according to what I found, metallib seems to be LLVM IR code#asahi-gpu · 2021-03-21 02:21
DarkShadow44hm, according to what I found, metallib seems to be LLVM IR code#asahi-gpu · 2021-03-21 01:38
dougall(or, if I'm understanding correctly, I think they're usually given to the driver as LLVM IR? which it specialises because it knows "this is a top level compute or whatever function"? but that's mainly based on having used those two tools on the same functions and seen the code differences, so I'm not sure)#asahi-gpu · 2021-03-21 01:38
dougall(or, if I'm understanding correctly, I think they're usually given to the driver as LLVM IR? which it specialises because it knows "this is a top level compute or whatever function"? but that's mainly based on having used those two tools on the same functions and seen the code differences, so I'm not sure)#asahi-gpu · 2021-03-21 01:33
dougalland yeah, no idea - i don't really know how metal works, sorry#asahi-gpu · 2021-03-21 01:33
dougalland yeah, no idea - i don't really know how metal works, sorry#asahi-gpu · 2021-03-21 01:31
dougall(i got it working with an old revision of asahilinux/gpu and never updated - iirc one of these hardcoded offsets worked for me https://github.com/AsahiLinux/gpu/blob/b9591908e19a737aaa60c28619fbd39a091ce0f1/wrap/wrap.c#L143 )#asahi-gpu · 2021-03-21 01:31
dougall(i got it working with an old revision of asahilinux/gpu and never updated - iirc one of these hardcoded offsets worked for me https://github.com/AsahiLinux/gpu/blob/b9591908e19a737aaa60c28619fbd39a091ce0f1/wrap/wrap.c#L143 )#asahi-gpu · 2021-03-21 01:31
DarkShadow44not quite sure how the caching/threads work yet#asahi-gpu · 2021-03-21 01:31
DarkShadow44not quite sure how the caching/threads work yet#asahi-gpu · 2021-03-21 01:31
DarkShadow44are shaders usually uploaded to the driver as source code? Or why is there a generation difference?#asahi-gpu · 2021-03-21 01:31
DarkShadow44are shaders usually uploaded to the driver as source code? Or why is there a generation difference?#asahi-gpu · 2021-03-21 01:30
DarkShadow44about the caching bit, I only knew about metallib shader files#asahi-gpu · 2021-03-21 01:30
DarkShadow44about the caching bit, I only knew about metallib shader files#asahi-gpu · 2021-03-21 01:30
DarkShadow44oh I see...#asahi-gpu · 2021-03-21 01:30
DarkShadow44oh I see...#asahi-gpu · 2021-03-21 01:29
dougalli'm like 90% sure - yeah - the tricky bit is it'll dump code for about six other different shaders and you have to find the code you care aboout at some offset in one of the dumped mappings...#asahi-gpu · 2021-03-21 01:29
dougalli'm like 90% sure - yeah - the tricky bit is it'll dump code for about six other different shaders and you have to find the code you care aboout at some offset in one of the dumped mappings...#asahi-gpu · 2021-03-21 01:27
DarkShadow44ah thanks. so, to be clear, dump_mappings does indeed dump G13 code as well?#asahi-gpu · 2021-03-21 01:27
DarkShadow44ah thanks. so, to be clear, dump_mappings does indeed dump G13 code as well?#asahi-gpu · 2021-03-21 01:24
dougall(e.g. it'll never use the discard hint, as it can't assume all threads are active when the library function is called)#asahi-gpu · 2021-03-21 01:24
dougall(e.g. it'll never use the discard hint, as it can't assume all threads are active when the library function is called)#asahi-gpu · 2021-03-21 01:23
dougalli find this branch the easiest way to build and get G13 code from a metallib: https://github.com/Thog/gpu/tree/metallib (you can modify macho_disasm.c to write the code to a file instead of calling agx_disassemble... but metallib code does compile a bit differently to non-library code, so something like dump_mappings is preferable for that)#asahi-gpu · 2021-03-21 01:23
dougalli find this branch the easiest way to build and get G13 code from a metallib: https://github.com/Thog/gpu/tree/metallib (you can modify macho_disasm.c to write the code to a file instead of calling agx_disassemble... but metallib code does compile a bit differently to non-library code, so something like dump_mappings is preferable for that)#asahi-gpu · 2021-03-21 01:19
DarkShadow44yes, for analysing the ISA#asahi-gpu · 2021-03-21 01:19
DarkShadow44yes, for analysing the ISA#asahi-gpu · 2021-03-21 01:19
dougall(to be clear you want g13 instructions, rather than llvm ir, right?)#asahi-gpu · 2021-03-21 01:19
dougall(to be clear you want g13 instructions, rather than llvm ir, right?)#asahi-gpu · 2021-03-21 01:18
DarkShadow44bloom: How exactly snooping GPU memory? Is that what comes out from wrap.c:dump_mappings?#asahi-gpu · 2021-03-21 01:18
DarkShadow44bloom: How exactly snooping GPU memory? Is that what comes out from wrap.c:dump_mappings?