#asahi-gpu · 2023-08-27 05:17
i509vcbstill doesn't fix the issue where if the sysval being loaded has a binding that isn't zero always fails...#asahi-gpu · 2023-08-27 05:15
i509vcbYou get a race condition#asahi-gpu · 2023-08-27 05:15
i509vcbI guess I learned what happens when you use agx_usc_uniform on the same uniform registers twice#asahi-gpu · 2023-08-27 04:56
i509vcbhuh it's flaking#asahi-gpu · 2023-08-27 04:50
i509vcbThe base is intentionally hardcoded to 0 as I have shifted other things over in the uniform registers#asahi-gpu · 2023-08-27 04:50
i509vcbWhich in the case of load_num_workgroups is this: https://gist.github.com/i509VCB/b343bb352ecaad0f23245330359add54#asahi-gpu · 2023-08-27 04:49
i509vcbThat's replacing load_sysval_agx#asahi-gpu · 2023-08-27 04:49
i509vcbI *think* this lowering is correct, not sure why vulkan keeps saying I am loading (0, 0, 0) through: https://gist.github.com/i509VCB/fce24eb2825733cc4bfacef043b398ba#asahi-gpu · 2023-08-27 01:52
i509vcbI'm going to take moving over fully to the sysval buffer a little more slowly, I've found that trying to do push constants, descriptors and vbo stuff at the same time as num_workgroups to be a bit hard to test properly#asahi-gpu · 2023-08-27 00:44
i509vcb32 uint64_t means 128 uniform registers just for buffers#asahi-gpu · 2023-08-27 00:44
i509vcbalthough it is definitely chunky#asahi-gpu · 2023-08-27 00:44
i509vcbMainly because of the compatibility stuff currently there#asahi-gpu · 2023-08-27 00:43
i509vcbI've left the bound buffers in the uniforms for now#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
i509vcbAnd I doubt I can do much better than the compiler right now #asahi-gpu · 2023-08-27 00:21
alyssasure, it's less work#asahi-gpu · 2023-08-27 00:21
i509vcbI guess the former sounds better from a maintaince standpoint since we already upload all the stuff into a buffer #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:19
i509vcbBut from a theoretical performance standpoint loading that value into a uniform register would just generate an redundant mov?#asahi-gpu · 2023-08-27 00:19
i509vcb> agx_usc_uniform is then used to copy from that struct to uniform registers according to the layout that you picked earlier#asahi-gpu · 2023-08-27 00:19
i509vcbI guess part of this question was reading #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:09
i509vcbhmm okay, so really the only usc_uniform call I'd probably do then is tell the driver where I uploaded the agxv_sysvals_whatever#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-27 00:05
i509vcbagx_emit_store_preamble?#asahi-gpu · 2023-08-27 00:05
i509vcbI have sorted sysvals so that uniform registers can be assigned, but I need to load a value from the sysval buffer and store it in a uniform reg for use#asahi-gpu · 2023-08-27 00:02
i509vcbnir_load_global_constant can be used to read from a buffer, but how do I tell nir to store that value into some uniform registers?#asahi-gpu · 2023-08-26 23:37
i509vcb(lhs and rhs in the sort function actually need to be cast to a const type *const*) #asahi-gpu · 2023-08-26 23:34
i509vcbnvm I figured out that I did something wrong in sort_sysval#asahi-gpu · 2023-08-26 23:31
i509vcbThis is very similar to what parts of nir do, but it seems to not work in agxv#asahi-gpu · 2023-08-26 23:30
i509vcbI've got to be doing something wrong here if qsort fails with garbage but a loop to check my sanity is fine: https://gist.github.com/i509VCB/a9aa0d30b4a4695379110002d2507119#asahi-gpu · 2023-08-26 22:16
i509vcbs/build-type/buildtype#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:16
i509vcbI heard that -Dbuild-type=debug causes gcc to build without optimizing out stuff, but that seems to do nothing?#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