#
✕ nick:lina
#asahi-gpu · 2023-09-08 13:48
linai509vcb: What limit are you thinking about? This is mostly for internal mesh/geom/etc emulation, not a buffer exposed to users
#asahi-gpu · 2023-09-08 13:46
linaAnd using blocks larger than 64MiB seems... kind of wasteful
#asahi-gpu · 2023-09-08 13:45
linaI don't think the GPU/firmware care about that, but there does seem to be what looks like a 64-bit bitmask of blocks involved, so whatever blocksize we pick we can only have up to 64 of them.
#asahi-gpu · 2023-09-08 13:45
linaI think macOS just restricts it to 4GiB of address space
#asahi-gpu · 2023-09-08 13:38
lina(And since as far as I can tell the mechanism is uniform, it doesn't even have to be compute, I can just have a render pass request allocatinon)
#asahi-gpu · 2023-09-08 13:37
linaalyssa: Do you want me to look at this more or is this enough to make up a plan? I *think* I can easily test this whole mechanism from the m1n1 python stuff, since it doesn't really have to involve shaders (I can just pre-populate the buffers with whatever I want and dump whatever the firmware did to them)
#asahi-gpu · 2023-09-08 13:17
linaThen we could even do driconf overrides for known problem apps
#asahi-gpu · 2023-09-08 13:17
linaalyssa: I know we don't know the max required blocks, but it seems more useful to allow that to be set from userspace (e.g. via env variable) than a single global kernel module parameter?
#asahi-gpu · 2023-09-08 13:17
linaalyssa: Yes, "job" is a RunCompute
#asahi-gpu · 2023-09-08 10:08
linaOur ioctl could pass in a max required blocks size, and then at submit time the kernel ensures the global shared allocation has at least that much space. Then we mutex job execution using the global buffers (considering this another resource, blocking via a fence), but lazily drag buffer blocks between VMs so we avoid remapping and zeroing out when the jobs actually use less than the max memory.
#asahi-gpu · 2023-09-08 10:07
linaAnd the requirement is that everything is submitted as one ioctl, from alloc to free
#asahi-gpu · 2023-09-08 10:06
linaI think for us, the ABI for this would look essentially the same as the firmware ABI, except we use a BO and offsets for the count/shared buffers with the firmware (then we can map it in firmware land without making it world writable like Apple does, they're so bad at this...)
#asahi-gpu · 2023-09-08 09:06
linaSo we could use a different blocksize, but we'd lower our max usage if we do that.
#asahi-gpu · 2023-09-08 09:06
linaOhh but I think the firmware may have a 64-bit free blockmap, so max 64 blocks. Blocks are 64MiB on macOS, which means 4GiB max buffer size, which makes sense as a max.
#asahi-gpu · 2023-09-08 09:00
linaMy guess is that's an uncached store or something like that, since the firmware needs to be coherent with this stuff.
#asahi-gpu · 2023-09-08 09:00
lina 1ca: 4591280510f83200 device_store.TODO 0, i32, xy, r18_r19, r12_r13, 2, signed, lsl 2, 1, 1, 0, 3, 0
#asahi-gpu · 2023-09-08 09:00
linaThe only interesting thing in the shaders is those shared memory counts are written to like this:
#asahi-gpu · 2023-09-08 08:59
linaAlso everything is done in discrete "block count" units but I think the firmware doesn't care about where we alloc or how big a block is, since that's just up to the shaders/kernel
#asahi-gpu · 2023-09-08 08:58
linaIn typical Apple fashion, it's overcomplicated with two layers of accounting for buffer size/usage...
#asahi-gpu · 2023-09-08 08:58
linaSo the "just in time" allocation mechanism is just there so the jobs don't have to pingpong through the kernel for allocs, but rather they can be queued at the firmware eagerly and only when the firmware is about to run a job does it poke the kernel to allocate its memory
#asahi-gpu · 2023-09-08 08:57
linaFor mesh, there are 3 compute jobs: the first one calculates the first allocation, the second one writes to it and calculates the second allocation, then the third one writes out the mesh data/stuff into the second allocation, then the final 3d/ta job uses that.
#asahi-gpu · 2023-09-08 08:56
linaEach job has an alloc request and a free request, and writes out the alloc/free request counts of the next job
#asahi-gpu · 2023-09-08 08:55
linaInstead what they do is they have a compute shader calculate how much memory is needed, and write that out to some shared memory, then when the next shader runs that shared memory location is passed to the firmware as an alloc request, and then the firmware allocates memory before running it.
#asahi-gpu · 2023-09-08 08:54
linaIt's all firmware and shared memory, there is no mechanism to interrupt a shader or anything like that.
#asahi-gpu · 2023-09-08 08:53
linaalyssa: Soooo.... there's no mailbox ^^;;
#asahi-gpu · 2023-09-04 16:00
linaOur numbers will only grow~
#asahi-gpu · 2023-09-04 16:00
linamay or may not have plans to teach another catgirl programming...
#asahi-gpu · 2023-09-04 15:26
linaWhatever works! ^^
#asahi-gpu · 2023-08-30 09:18
linaalyssa: When you're around, there's a new Dolphin issue seemingly related to MSAA+Depth that goes away when I flush after every draw, so I think it's shader related ^^
#asahi-gpu · 2023-08-30 05:27
linaalyssa: New kernel debug_flags bit 0x2000 to verbosely explain UAPI usage errors (you probably want that on always by default)
#asahi-gpu · 2023-08-28 04:52
linai509vcb: yes, you need to split to have more
#asahi-gpu · 2023-08-17 03:39
linaIf you have a branch/testcase I can use to try it I can look at it tomorrow ^^
#asahi-gpu · 2023-08-17 03:38
linaThat is totally untested, I just wrote it blind...
#asahi-gpu · 2023-08-17 03:38
linaOh it might be that timeline stuff is just completely broken
#asahi-gpu · 2023-08-17 03:37
lina(And then if a fence never gets signaled that can jam all of KDE)
#asahi-gpu · 2023-08-17 03:37
linaThe driver is really good with memory safety stuff but there are still definitely bugs in the queuing logic/etc (plus drm_sched problems) that can cause things to get stuck I think...
#asahi-gpu · 2023-08-17 03:36
linaThat sounds like a bug...
#asahi-gpu · 2023-08-16 13:25
linaThat imm doesn't make sense to me... (looking at the helper)
#asahi-gpu · 2023-08-16 13:24
linaAny chance that is disassembled wrong?
#asahi-gpu · 2023-08-16 13:24
lina 128: e2023004 mov_imm r0h.cache, 1072
#asahi-gpu · 2023-08-16 13:07
linaalyssa: In my single test it was 61 per core for vertex, and for compute that was capped at some max based on local memory utilization etc, so it's probably just "the max occupancy" for vertex.
#asahi-gpu · 2023-08-16 12:47
linaTBH, the core mapping thing is overkill... The table is already a table of pointers to stack blocks, so a dummy core is just 16 bytes * max_active_threadgroups which isn't thaat much wasted space.
#asahi-gpu · 2023-08-16 12:46
lina(We already have the core table in the UAPI so the driver has what it needs to do that)
#asahi-gpu · 2023-08-16 12:45
linabut not all cores exist in all GPUs so you want to remap to avoid wasting table space.
#asahi-gpu · 2023-08-16 12:45
linaMy guess given what we saw now is that it maps 1-4 blocks of stack space, each of which is encoded in a particular way (size/addr compressed together). It receives a structure that is basically an array of those pointers for each threadgroup(?) for each core that can be active at the same time, and indexes into it. There's also a core mapping table, since presumably the core IDs the shaders get are "raw"
#asahi-gpu · 2023-08-16 12:43
linaI already took a good look at how that works so at this point I think I only need the magic instructions/SRs to make it do something useful
#asahi-gpu · 2023-08-16 12:42
linaFor the helper program, if you can help get the mystery instructions into the backend I can try to implement the logic (I'm leaving all the buffers up to userspace, unlike macOS, so we can use our own structures/layouts, we don't have to copy theirs)
#asahi-gpu · 2023-08-16 12:41
linaalyssa: MR for the decoder stuff opened, I'll let you figure out when we merge the UAPI stuff but we might want to do it soonish? If you can validate the bindless sampler stuff, layered rendering is tested and the helper program thing is pretty obvious.
#asahi-gpu · 2023-08-16 12:28
linaApparently the VDM barrier command is also return??
#asahi-gpu · 2023-08-16 12:28
linaAnd I also figured out stream call/return, I can push some decoder stuff for that, since they use that.

plus ›