#
✕ nick:alyssa
#asahi-gpu · 2023-08-29 13:24
alyssaDon't put the push constants themselves on the agx_sysvals, instead put the u64 pointer to the push constant buffer there
#asahi-gpu · 2023-08-29 13:23
alyssayou shouldn't need this
#asahi-gpu · 2023-08-29 13:23
alyssai509vcb: " 21:38 <i509vcb> alyssa: would you mind if load_sysval_agx allowed the binding to be a nir_def. I'd like to avoid the extra indirection for getting push constants but binding being a fixed int makes that hard "
#asahi-gpu · 2023-08-29 12:23
alyssayeah
#asahi-gpu · 2023-08-29 04:16
alyssashould be simpler than what the gl driver has to do
#asahi-gpu · 2023-08-29 04:16
alyssaso you would just lower derefs straight to bindless and not allocate texture state registers
#asahi-gpu · 2023-08-29 04:16
alyssafor vulkan, there's no binding tables in the API
#asahi-gpu · 2023-08-29 04:16
alyssai509vcb: the gl driver lowers binding tables to bindless because it's too late by the time it hits the driver, since GL is based on binding tables
#asahi-gpu · 2023-08-28 17:18
alyssa(with everything unified)
#asahi-gpu · 2023-08-28 17:18
alyssalooking forward to the final form of the patch :)
#asahi-gpu · 2023-08-28 17:18
alyssai509vcb: looks like you're on the right track
#asahi-gpu · 2023-08-27 19:42
alyssa:+1:
#asahi-gpu · 2023-08-27 12:12
alyssa(alternatively, you could pass the entirety of the sysval buffer to agx_usc_uniform and then use the load_sysval_agx you implemented above, without the load. but that is very chunky since you dont use most of those uniforms in a given pipeline, which is why the gl driver has the layout code.)
#asahi-gpu · 2023-08-27 12:12
alyssathat 0000 is a hexdump of the content of the uniform
#asahi-gpu · 2023-08-27 12:11
alyssaif you want to put an address in a uniform, you need to pool_upload the address to the cmdbuf pool and pass /that/ address to usc_uniform
#asahi-gpu · 2023-08-27 12:11
alyssaagx_usc_uniform works like a memcpy: move the contents of this GPU memory into these uniforms
#asahi-gpu · 2023-08-27 12:10
alyssasince you put the address int he buffer and then you need to load from the address int he buffer
#asahi-gpu · 2023-08-27 12:10
alyssaload_global_const(load_global_const(load_preamble(0) + offset to the num_workgroups))
#asahi-gpu · 2023-08-27 12:10
alyssafor load_num_wrkgroups that means there would be 2 dependent loads in this case
#asahi-gpu · 2023-08-27 12:09
alyssaat least as it's used in the GL driver, load_sysval_agx is intended to return the value
#asahi-gpu · 2023-08-27 12:09
alyssathis would load the /address/ of the sysval, you need to wrap this whole thing in a load_const_agx
#asahi-gpu · 2023-08-27 12:08
alyssahttps://gist.github.com/i509VCB/fce24eb2825733cc4bfacef043b398ba
#asahi-gpu · 2023-08-27 12:06
alyssathat's a lot of messages
#asahi-gpu · 2023-08-27 00:22
alyssaprobably not optimal for a produciton vk driver but the optimizations can come later easier
#asahi-gpu · 2023-08-27 00:22
alyssaand the only usc_uniform is for that single 64-bit address at u0_u1
#asahi-gpu · 2023-08-27 00:21
alyssain #1, the only load_preamble you generate is for the address of the the sysval buffer
#asahi-gpu · 2023-08-27 00:21
alyssasure
#asahi-gpu · 2023-08-27 00:21
alyssasure, it's less work
#asahi-gpu · 2023-08-27 00:20
alyssain the first case the compiler deals with it
#asahi-gpu · 2023-08-27 00:20
alyssain the second case only you use agx_usc_uniform to copy things into place
#asahi-gpu · 2023-08-27 00:20
alyssa2. you do assign uniforms, and instead of generating load_global_const, you generate load_preamble and the compiler won't touch that
#asahi-gpu · 2023-08-27 00:20
alyssa1. you do not assign uniforms, you just generate load_global_const and let the compiler go to town
#asahi-gpu · 2023-08-27 00:19
alyssauhh there are two options
#asahi-gpu · 2023-08-27 00:10
alyssaand set the compiler input accordingly so your uniforms dont get stomped on
#asahi-gpu · 2023-08-27 00:09
alyssaotoh, if you want to calculate layouts yourself, then you use usc_uniform in the driver and you have to emit load_preamble directly -- not load_global_constant
#asahi-gpu · 2023-08-27 00:09
alyssaright
#asahi-gpu · 2023-08-27 00:09
alyssain practice, the compiler will internally generate store_preamble instructions to optimize the load into a uniform, but that's completely invisible to the driver
#asahi-gpu · 2023-08-27 00:08
alyssano layouts for the driver to consider, no usc_uniform calls
#asahi-gpu · 2023-08-27 00:08
alyssaand there are no uniform registers involved from the drivers perspective
#asahi-gpu · 2023-08-27 00:08
alyssaif you emit load_global_constant, that means the value is read /in the shader/ directly
#asahi-gpu · 2023-08-27 00:08
alyssai509vcb: short answer is "you dont'"
#asahi-gpu · 2023-08-26 22:16
alyssaI only ever do debugoptimized (default) or release
#asahi-gpu · 2023-08-26 22:16
alyssaIDK
#asahi-gpu · 2023-08-26 22:15
alyssasaves a few instructions from the preamble, might not be any faster in practice.
#asahi-gpu · 2023-08-26 22:14
alyssaThe optimization would be what the GL driver does, analyzing the ranges that are used and binding those ranges
#asahi-gpu · 2023-08-26 22:14
alyssaThat's the absolute easiest approach
#asahi-gpu · 2023-08-26 22:14
alyssai509vcb: The details are up to you
#asahi-gpu · 2023-08-25 10:52
alyssait would be a lot more useful in rust.
#asahi-gpu · 2023-08-25 10:51
alyssai509vcb: certainly it's possible to do that, for panfrost I used the `mali_ptr` typedef for that ... it's not as useful as it seems, though, since C will do implicit casting between u64 and agx_gpu_ptr so the type annotation becomes a purely optional hint
#asahi-gpu · 2023-08-24 18:03
alyssathx

plus ›