00:59 fdobridge: <a​irlied> @gfxstrand does 24916 make sense?
01:01 fdobridge: <g​fxstrand> IDK. Is that what other drivers do?
01:02 fdobridge: <a​irlied> seems to be
01:04 fdobridge: <g​fxstrand> Okay then
01:08 airlied: dakr: didn't make it through a full cts run
01:09 airlied: one of my cpu's got stuck
01:09 airlied: https://paste.centos.org/view/raw/520f3aef
08:59 dakr: airlied: updated the branch, should be fixed.
15:17 sravn: gfxstrand: Thanks for the nice mini-blog on mastodon - https://mastodon.social/@gfxstrand@mastodon.gamedev.place/110982162976578240
15:59 fdobridge: <g​fxstrand> 😄
15:59 fdobridge: <g​fxstrand> FYI all: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998
16:01 fdobridge: <g​fxstrand> Now to pull out the NIR bits into their own MR.
16:02 fdobridge: <g​fxstrand> There's not many. Just a few intrinsics and texops
16:03 fdobridge: <k​arolherbst🐧🦀> I wonder if at this point it makes sense to move some abstractions into core mesa bits, but might also not make much sense at this point
16:05 fdobridge: <g​fxstrand> What abstractions?
16:07 fdobridge: <k​arolherbst🐧🦀> no idea, you seem to use some nir functions, but maybe you just call into them directly and doesn't have any wrappers
16:07 fdobridge: <k​arolherbst🐧🦀> uhm.. meant nir wrappers, not abstractions
16:11 fdobridge: <g​fxstrand> Some of the wrappers can probably be eliminated at this point. There was a bunch of stuff for dealing with `is_ssa` but that's gone now.
16:12 fdobridge: <g​fxstrand> Some of it is just making NIR more rust friendly for things like iteration. Oh, and turing src arrays into slices safely.
16:12 fdobridge: <k​arolherbst🐧🦀> yeah...
16:12 fdobridge: <g​fxstrand> Mostly, I didn't want any unsafe code in my NIR -> NAK pass.
16:12 fdobridge: <k​arolherbst🐧🦀> I have some wrapper class around `nir_shader` to generate iterators over variables and stuff
16:12 fdobridge: <g​fxstrand> Yeah, I stole your wrapper. 😛
16:12 fdobridge: <k​arolherbst🐧🦀> and call passes
16:12 fdobridge: <k​arolherbst🐧🦀> 😄
16:12 fdobridge: <k​arolherbst🐧🦀> you could upstream your changes
16:12 fdobridge: <k​arolherbst🐧🦀> and we could move it around
16:12 fdobridge: <g​fxstrand> Thing is.... the way NAK is using NIR and the way Rusticl is using NIR are very different.
16:13 fdobridge: <g​fxstrand> The wrappers I have in NAK assume everything is immutable.
16:13 fdobridge: <k​arolherbst🐧🦀> yeah... fair enough
16:13 fdobridge: <k​arolherbst🐧🦀> but that shouldn't be a problem in theory
16:13 fdobridge: <k​arolherbst🐧🦀> but I also haven't looked
16:13 fdobridge: <k​arolherbst🐧🦀> so don't know
16:15 fdobridge: <g​fxstrand> I think you could even make some of it mutable-safe if you assume that the user will never poke at pointers.
16:15 fdobridge: <k​arolherbst🐧🦀> yeah... I mean most of the methods touching the pointers are already `&mut` like the passes
16:16 fdobridge: <g​fxstrand> The other big problem is that things like `NirSrc::is_const()` require chasing SSA values and that totally blows up Rust's reference tracking.
16:16 fdobridge: <k​arolherbst🐧🦀> mhhh
16:16 fdobridge: <k​arolherbst🐧🦀> if you could pull out all the nir wrapper code into its own series/patches/whatever I could probably take a look and see if anything could be improved here
16:17 fdobridge: <g​fxstrand> It's all in one patch
16:17 fdobridge: <k​arolherbst🐧🦀> ahh okay
16:17 fdobridge: <g​fxstrand> I just keep squashing stuff into the one patch
16:19 fdobridge: <g​fxstrand> But, yeah, making NIR Rust-accessible is something we probably want to do. It's just going to take some time and thought. I may also need to do a little digging into bindgen to see if we can control it a bit more.
16:20 fdobridge: <k​arolherbst🐧🦀> yeah...
16:20 fdobridge: <g​fxstrand> Like, if there were some way that we could decorate exec lists to make it generate a different type or something.
16:20 fdobridge: <k​arolherbst🐧🦀> I was using a pretty old version of bindgen and there might be some new features worth using
16:20 fdobridge: <k​arolherbst🐧🦀> mhhh
16:20 fdobridge: <k​arolherbst🐧🦀> maybe?
16:20 fdobridge: <k​arolherbst🐧🦀> but maybe that will also need C23 🙃
16:21 fdobridge: <g​fxstrand> C23?
16:21 fdobridge: <k​arolherbst🐧🦀> yeah.. it added interesting features for those things
16:22 fdobridge: <k​arolherbst🐧🦀> it also fixes the entire enum mess
16:22 fdobridge: <k​arolherbst🐧🦀> adds typed enums
16:22 fdobridge: <k​arolherbst🐧🦀> C23 is actually quite huge
16:24 fdobridge: <k​arolherbst🐧🦀> but probably will take 10 years until we can use it inside mesa 😄
16:24 fdobridge: <g​fxstrand> So, bindgen has a type replace thing: https://rust-lang.github.io/rust-bindgen/replacing-types.html
16:24 fdobridge: <g​fxstrand> But it doesn't look like that will work for what we want because it just replaces one type with another. It can't re-type a single variable.
16:24 fdobridge: <k​arolherbst🐧🦀> ohh.. interesting
16:26 fdobridge: <k​arolherbst🐧🦀> but yeah...
16:26 fdobridge: <k​arolherbst🐧🦀> I don't think it's a major problem to just type it in the rust wrapper
16:26 fdobridge: <k​arolherbst🐧🦀> but yeah...
16:27 fdobridge: <g​fxstrand> What I'd like to do is be able to replace `struct exec_list` with `ExecList<nir_instr, 8>` where 8 is the offset to the node or something like that.
16:27 fdobridge: <k​arolherbst🐧🦀> maybe @lingm knows something
16:28 fdobridge: <g​fxstrand> The other problem is that, thanks to the Meson mess with bindgen, we can't ever make a field private.
16:28 fdobridge: <g​fxstrand> If I could make the bindgen stuff and the wrappers be in the same crate, we could make things private and hide a lot of dangerous details.
16:29 fdobridge: <g​fxstrand> Here's a crazy thought.... Have bindgen generate nir_h.rs and then have a nir_impl.rs file and then use `cat` to paste them together and compile that.
16:29 fdobridge: <g​fxstrand> It's horrible but it'd work.
16:29 fdobridge: <k​arolherbst🐧🦀> yeah there was an idea like that
16:30 fdobridge: <k​arolherbst🐧🦀> you can also just copy the source files into the generated directory and have it as one crate
16:30 fdobridge: <k​arolherbst🐧🦀> I think that's even supported?
16:31 fdobridge: <k​arolherbst🐧🦀> maybe not...
16:31 fdobridge: <k​arolherbst🐧🦀> but I think there were patches for it
16:31 fdobridge: <k​arolherbst🐧🦀> that's kinda the official way of doing it btw 🙃
16:31 fdobridge: <k​arolherbst🐧🦀> using `includue!` to just include the generated file
16:31 fdobridge: <k​arolherbst🐧🦀> *include
16:32 fdobridge: <k​arolherbst🐧🦀> but you have to give it a path
16:32 fdobridge: <k​arolherbst🐧🦀> and that's non trivial if your build directory is wherever
16:32 fdobridge: <k​arolherbst🐧🦀> and meson upstream decided they don't want to have a wrapper around bindgen to inject arbitrary env variables
16:33 fdobridge: <g​fxstrand> Honestly, `cat` isn't horrible.
16:33 fdobridge: <g​fxstrand> I mean, it's horrible, but it's not that horrible.
16:33 fdobridge: <k​arolherbst🐧🦀> developing that stuff is just annoying
16:34 fdobridge: <k​arolherbst🐧🦀> because... your IDE/tool/whatever can't really help you with auto completion and stuff
16:35 fdobridge: <k​arolherbst🐧🦀> I don't think we have to expose the raw C types everywhere and it's fine to have our own wrappers. If performance is critical we just use `repr(transparent)`
16:35 fdobridge: <k​arolherbst🐧🦀> and then you can just `mem::transmute` or whatever
16:37 fdobridge: <k​arolherbst🐧🦀> I think I kinda came to terms not being able to have it all in one crate
16:44 fdobridge: <g​fxstrand> I think for NIR wrappers, doing a cat trick is probably good enough.
16:45 fdobridge: <g​fxstrand> That would let us make dangerous fields private and then expose them through helper functions.
16:45 fdobridge: <g​fxstrand> I think that would go a long ways towards making me feel more comfortable with having something in src/compiler/nir.
16:45 fdobridge: <k​arolherbst🐧🦀> yeah.. maybe
16:46 fdobridge: <g​fxstrand> Making NIR so it's safe to mutate from Rust is a much bigger challenge.
16:46 fdobridge: <g​fxstrand> Calling passes isn't so bad but IDK how I feel about it.
16:47 fdobridge: <k​arolherbst🐧🦀> the bigger problem is just that static inline mess
16:47 fdobridge: <g​fxstrand> With NAK, I kept all the NIR passes in C and once it hits Rust, it's all immutable.
16:47 fdobridge: <g​fxstrand> Yes and no. There's not much that's static inline and most of it we want to rustify anyway.
16:47 fdobridge: <k​arolherbst🐧🦀> but yeah.. poking a bit deeper into the nir is kinda... hard
16:47 fdobridge: <g​fxstrand> Like returning option instead of NULL or assert.
16:48 fdobridge: <k​arolherbst🐧🦀> ohh.. I was more thinking about e.g. sharing the `NIR_PASS` stuff
16:48 fdobridge: <k​arolherbst🐧🦀> ended up just reimplementing it
16:48 fdobridge: <g​fxstrand> Yeah... that's a macro. Translating macros probably isn't something bindgen will ever be able to do.
16:49 fdobridge: <k​arolherbst🐧🦀> but there are some annoying static inlines I also have to use
16:49 fdobridge: <g​fxstrand> And, again, ther's reasons why nak_nir.c exists and isn't written in Rust. 🙂
16:49 fdobridge: <k​arolherbst🐧🦀> nothing terrible to port
16:49 fdobridge: <k​arolherbst🐧🦀> but I like to keep things consistent on both sides 😄
16:50 fdobridge: <k​arolherbst🐧🦀> yeah.. all I do is to run passes and iterate over variables, but the rusticl custom pass is also written in C
16:53 fdobridge: <k​arolherbst🐧🦀> I do however wonder if my way of code review of NAK will be to port it over to pre turing 🙃
17:28 fdobridge: <g​fxstrand> @marysaka is already working on SM50
17:40 fdobridge: <k​arolherbst🐧🦀> cool!
18:47 fdobridge: <g​fxstrand> The state of rust documentation and sphinx is making me sad. 😭
19:44 fdobridge: <k​arolherbst🐧🦀> just use rustdoc 😄
19:53 fdobridge: <g​fxstrand> Yeah, that's my plan.