#
…

2021-03-17

00:28JusticeE1 has quit [Ping timeout: 244 seconds]
00:28JusticeE1 has quit [Ping timeout: 244 seconds]
00:28JusticeE1 has quit [Ping timeout: 244 seconds]
00:33mxw39 has joined #asahi-gpu
00:33mxw39 has joined #asahi-gpu
00:33mxw39 has joined #asahi-gpu
01:34g3rp has joined #asahi-gpu
01:34g3rp has joined #asahi-gpu
01:34g3rp has joined #asahi-gpu
01:38g3rp has quit [Client Quit]
01:38g3rp has quit [Client Quit]
01:38g3rp has quit [Client Quit]
02:00DragoonAethis has quit [Quit: hej-hej!]
02:00DragoonAethis has quit [Quit: hej-hej!]
02:00DragoonAethis has quit [Quit: hej-hej!]
02:00DragoonAethis has joined #asahi-gpu
02:00DragoonAethis has joined #asahi-gpu
02:00DragoonAethis has joined #asahi-gpu
02:16JusticeEX has joined #asahi-gpu
02:16JusticeEX has joined #asahi-gpu
02:16JusticeEX has joined #asahi-gpu
02:18mxw39 has quit [Quit: Konversation terminated!]
02:18mxw39 has quit [Quit: Konversation terminated!]
02:18mxw39 has quit [Quit: Konversation terminated!]
02:18mxw39 has joined #asahi-gpu
02:18mxw39 has joined #asahi-gpu
02:18mxw39 has joined #asahi-gpu
02:19mxw39 has quit [Client Quit]
02:19mxw39 has quit [Client Quit]
02:19mxw39 has quit [Client Quit]
02:19mxw39 has joined #asahi-gpu
02:19mxw39 has joined #asahi-gpu
02:19mxw39 has joined #asahi-gpu
03:18odmir has quit [Remote host closed the connection]
03:18odmir has quit [Remote host closed the connection]
03:18odmir has quit [Remote host closed the connection]
03:27_whitelogger_ has quit [Remote host closed the connection]
03:27_whitelogger__ has quit [Remote host closed the connection]
03:38PhilippvK has joined #asahi-gpu
03:38phiologe has quit [Ping timeout: 260 seconds]
03:47mrkajetanp has joined #asahi-gpu
03:47mrkajetanp has quit [Client Quit]
04:11mxw39 has quit [Quit: Konversation terminated!]
04:27mxw39 has joined #asahi-gpu
04:40mxw39 has quit [Quit: Konversation terminated!]
06:08tbodt_ has quit [Quit: ZNC 1.6.6+deb1ubuntu0.2 - http://znc.in]
06:13tbodt has joined #asahi-gpu
06:20AlJaMa has quit [Quit: No Ping reply in 180 seconds.]
06:21AlJaMa has joined #asahi-gpu
06:21AlJaMa has joined #asahi-gpu
06:21AlJaMa has quit [Changing host]
08:04linkmauve has joined #asahi-gpu
09:45Necrosporus has quit [Read error: Connection reset by peer]
09:45Necrosporus has joined #asahi-gpu
09:51JusticeE1 has joined #asahi-gpu
09:55JusticeEX has quit [*.net *.split]
10:02thestr4ng3r has quit [Ping timeout: 256 seconds]
10:13thestr4ng3r has joined #asahi-gpu
10:15g3rp has joined #asahi-gpu
10:20user1tt[m] has joined #asahi-gpu
10:36zkrx has quit [Ping timeout: 256 seconds]
11:06zkrx has joined #asahi-gpu
12:29Necrosporus_ has joined #asahi-gpu
12:29Necrosporus is now known as Guest12169
14:07g3rp has quit [Quit: Lost terminal]
15:35JusticeE1 has quit [Ping timeout: 264 seconds]
15:38JusticeEX has joined #asahi-gpu
16:00hypergenesis[m] has quit [Quit: Idle for 30+ days]
16:00theracermaster has quit [Quit: Ping timeout (120 seconds)]
16:03theracermaster has joined #asahi-gpu
16:26jaalsa has quit [Quit: jaalsa]
16:27jaalsa has joined #asahi-gpu
16:39odmir has joined #asahi-gpu
17:36g3rp has joined #asahi-gpu
17:42hypergenesis[m] has joined #asahi-gpu
17:44DarkShadow4444 has joined #asahi-gpu
17:59DarkShadow4444Hello there, I don't have a lot experience in GPU development, but I'd be interested in helping your reverse engineering efforts.
17:59DarkShadow4444I've got background in blackbox RE and development though (wine), tips on how I would get started contributing? Small first tasks for something like that?
18:05jn__bloom: ^
18:05chrisfdougall: any chance you could fill out the device_load etc docs a bit more? there's clearly a bunch of stuff rattling around in your head only, about typed loads etc
18:06PhilippvK has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
18:06jn__DarkShadow4444: i suppose you've read the relevant Asahi documentation, and interesting blog posts already?
18:08DarkShadow4444jn__: Yes, I've read the progress report, "Dissecting the Apple M1 GPU" part1/2 and looked at the gpu repository
18:09morelightning[m] has joined #asahi-gpu
18:09phiologe has joined #asahi-gpu
18:10DarkShadow4444chrisf: Yeah I found that site as well, though I didn't read through all the operands. Does the author work with asahi as well?
18:10chrisfDarkShadow4444: one big area of useful things would be to help dougall flesh out the missing pieces
18:11chrisfauthor is here in the channel :)
18:11chrisfhave you got an M1 to poke at?
18:12DarkShadow4444I should be getting it soon
18:13g3rp has quit [Remote host closed the connection]
18:13chrisfwe also need to reverse the bulk of the command stream structures. `demo` in the gpu repo has a lot of mysterious stuff in it still
18:15DarkShadow4444Is there a process on how these known instructions are found out?
18:15DarkShadow4444Just compiling shaders and looking what the binary result is?
18:16chrisfpretty much. dougall has some other tricks, but ^ works.
18:19morelightning[m]I have an M1 and know the surface of Metal really well, but I don't know much about how to go about figuring out the command stream either. What tools are you guys using to look at it?
18:19morelightning[m](And can we do it on the Mac OS side first by replacing the kext or something? I feel like doing it directly in linux would be unwieldy.
18:25chrisfmorelightning[m]: everything so far is done by intercepting between the userspace driver (which does the "metal" stuff) and the kext
18:26DarkShadow4444chrisf: That should give most bit structures, but how to find out what the instructions actually do without running them?
18:26chrisfyou run them :)
18:28morelightning[m]Do you mean the intercepting is done inside Mac OS then? Where is that toolset at?
18:28DarkShadow4444ah I found the object code sample ^^good, since I don't know metal myself (yet)
18:29chrisfmorelightning[m]: all inside mac os
18:34odmir_ has joined #asahi-gpu
18:34odmir has quit [Read error: Connection reset by peer]
18:35morelightning[m]I skimmed through Alyssa's code on github briefly, but maybe I missed that part, unless thats part of the wrapper thing. It wasn't so clear whether it was to run on the Mac or linux.
18:35chrisfthe wrapper intercepts the IOKit calls to the kernel driver
18:36morelightning[m]OH okay. So we are saying all the calls are eventually going through IOKit?
18:36chrisfyes, and there's only a few -- of the "allocate some memory", "execute this command buffer in memory", variety
18:37chrisfeverything interesting is done in userspace, and you can get underneath it
18:37morelightning[m]Well that makes me feel a lot better 😂
18:38chrisfit's really not too unpleasant
18:38chrisfi mean, you have to run macos ;)
18:38chrisfbut it's given up its secrets fairly readily so far
18:38theracermaster5 has joined #asahi-gpu
18:39chrisfbloom, dougall jump in any time eh :)
18:40DarkShadow4444How exaclty do I have to understand "D = ALUDst(Dx:D, Dt)" and "D.broadcast_to_active(imm32)" ?
18:40DarkShadow4444I assume for Dx = 100 and D = 1 and Dt = 10 we get 32bit Register number (4 >> 1) and then?
18:41chrisfim only half paying attention
18:41morelightning[m]I guess I had this incorrect notion, that if we replaced metal, without replacing the kext, there would be interference conflict. But it sounds like, that's not the case.
18:41chrisfthat sounds correct -- and the Dt field is cache control
18:44DarkShadow4444alrighty then. Sounds like something I could help with. Kinda familar to the last time I reverse engineered a MS binary blob
18:44DarkShadow4444probably gonna need to play around with it quite a bit before I can do anything productive though
18:46odmir_ has quit [*.net *.split]
18:46theracermaster has quit [*.net *.split]
18:46theracermaster5 is now known as theracermaster
18:51odmir has joined #asahi-gpu
18:55g3rp has joined #asahi-gpu
18:56chrisfDarkShadow4444: note the topic
18:56morelightning[m]I got the interceptor running, though it crashed, I guess I'll try a simpler metal project
18:57chrisfDarkShadow4444: *no* taking the driver binaries apart, etc. only observe their behavior from the outside.
19:00DarkShadow4444chrisf: I know, I'm talking about an unknown binary data format. Run through compiler and compare output, nothing more.
19:03g3rp has left #asahi-gpu [#asahi-gpu]
19:10morelightning[m]Hmm, the dump_mappings() function keeps crashing when it gets to submit command buffers.
19:11g3rp has joined #asahi-gpu
19:13chrisfmorelightning[m]: simpler example, or dig into why it doesnt work
19:13chrisfmorelightning[m]: it works with the MetalComputeBasic sample
19:13chrisfmorelightning[m]: and with at least one trivial drawing sample
19:21morelightning[m]Is MetalComputeBasic still around on the internet? I definitely remember it, but it seems completed erased.
19:25TheJollyRoger has quit [Ping timeout: 268 seconds]
19:26TheJollyRoger has joined #asahi-gpu
19:27morelightning[m]Ah that worked, though the simple triangle samples don't.
19:32chrisfmorelightning[m]: figure out why :)
19:44morelightning[m]Well the file handle goes null, and I see memory allocation calls.... I am wondering if everyone has been testing without displaying to the screen?
19:45chrisfthe drawing example i looked at was offscreen, yes
19:45chrisfhaving to interact with an IOSurface adds a lot of complexity
20:02Baughn has quit [Ping timeout: 265 seconds]
20:04morelightning[m]It looks like, the console log still works with more complex projects if the dump mapping is taken out.
20:05DarkShadow4444 has quit [Quit: Leaving]
20:17mxw39 has joined #asahi-gpu
20:30morelightning[m]Actually, it's working now with the dump mappings. I don't understand it at all. Those errors were very real across 4 projects, and it's all gone now. 😅
20:33chrisfsuggests we dont understand something
20:33chrisfbloom: ^
20:36morelightning[m]But is that even possible? Would the machine really going into a different state across large time spans? Or that across time, something could change in such a drastic way?
20:40chrisfstick lldb on it an see how the wrapper went wrong?
20:42morelightning[m]I probably just need to take a break. I think the default file path on the github for dump mappings () is not writable so it crashes - just a simple file write error
20:42chrisfthat seems fairly benign as things going wrong go ;)
20:44morelightning[m]I was confused because it was mixing with the other entries in the console, and it didn't instantly occur to me that they were happening separately.
20:52morelightning[m]In anycase, I can see my own metal projects fine through it, and the commands are showing up, so this is promising.
20:52morelightning[m]I suppose, the next question, is what aspects to review first. I read some comments about memory not being fully understood.
20:58svenpeter is now known as svenpeter1
20:58svenpeter1 is now known as svenpeter
21:55g3rp has left #asahi-gpu [#asahi-gpu]
21:57JusticeEX has quit [Ping timeout: 256 seconds]
22:22Baughn has joined #asahi-gpu
22:34Baughn has quit [Remote host closed the connection]
22:35Baughn has joined #asahi-gpu
22:44chrisfmorelightning[m]: if you're interested in command stream side, compare what you're getting with what `demo` does
22:46chrisfpossibly look at the (much simpler) command stream for compute shader only
22:47chrisftease out the unknown things one by one
22:56* bloomhas some notes on compute shaders from last weekend
22:56bloomThe big headscratcher is cmd_*.bin
22:57bloomthis has a pointer to another buffer which is quite clearly the command buffer and which I could understand well enough
22:57bloombut it also has a lot of other magic numbers, pointers to zero, etc that don't make much sense, and that got copied into `demo` verbatim
22:57bloom(Not *nearly* enough entropy to be firmware, in case anyone was wondering)
23:03Baughn has quit [Ping timeout: 260 seconds]
23:15Baughn has joined #asahi-gpu
23:16Baughn has quit [Client Quit]
23:16Baughn has joined #asahi-gpu
23:35linkmauve has left #asahi-gpu [#asahi-gpu]
…