#
✕ nick:bloom
#asahi-gpu · 2021-04-12 00:14
bloom1.0 / math.tau = 0.15915494309189535
#asahi-gpu · 2021-04-12 00:14
bloomstruct.unpack('f', bytes([0x83, 0xF9, 0x22, 0x3E])) = 0.15915493667125702
#asahi-gpu · 2021-04-12 00:14
bloomanyway, sure enough checking the memory dump u0 = 0x3E22F983, and
#asahi-gpu · 2021-04-12 00:14
bloomer, no, we want the reciprocal of that. units are hard
#asahi-gpu · 2021-04-12 00:10
bloomThis corresponds to the trig identity cos(x) = sin(x + pi/2) = sin(x + tau/4), so we expect that u0 = 2pi = tau
#asahi-gpu · 2021-04-12 00:10
bloom*fmul
#asahi-gpu · 2021-04-12 00:10
bloomfadd r1, r0, u0
#asahi-gpu · 2021-04-12 00:10
bloomvs
#asahi-gpu · 2021-04-12 00:10
bloom 8: ba05c0021810 fmadd $r1, r0.discard, u0, 0.25
#asahi-gpu · 2021-04-12 00:10
bloomObservation 1: the asm of fcos is identical to fsin, except the first instruction
#asahi-gpu · 2021-04-12 00:10
bloomTaking a peak at fsin/fcos
#asahi-gpu · 2021-04-11 23:18
bloombut if the idea is right it should be obvious how to construct test programs for that
#asahi-gpu · 2021-04-11 23:18
bloomprobably worth confirming issue a lot more loads
#asahi-gpu · 2021-04-11 23:15
bloomAck
#asahi-gpu · 2021-04-11 23:14
bloomNote to self: >4 render targets has some seriously weird shader stuff
#asahi-gpu · 2021-04-11 22:18
bloomdougall: Also, patches incoming for `blend` and maybe `ld_var` if I have time before getting bored and reading a novel :p
#asahi-gpu · 2021-04-11 20:40
bloomI guess just more convenient that way. Probably will merge them for whatever i end up doing.
#asahi-gpu · 2021-04-11 20:39
bloomdougall: Any reason why applegpu.py seperates {A,B,C,D} from {A,B,C,D}t? It looks like the fields are always adjacent
#asahi-gpu · 2021-04-11 20:11
bloomDarkShadow44: I'm not sure if they added support or not, it's definitely on their wishlist though.
#asahi-gpu · 2021-04-11 18:23
bloomat the cost of introducing a slew of other issues..
#asahi-gpu · 2021-04-11 18:23
bloomand it avoids ^^ those sorts of issues
#asahi-gpu · 2021-04-11 18:23
bloomDarkShadow44: yep.
#asahi-gpu · 2021-04-11 18:18
bloomhas always ignored the 'nice' methods of doing this, preferring to just savagely parse GPU memory at runtime
#asahi-gpu · 2021-04-11 16:06
bloom....why is `stac_adjust/stack_store/stack_load` the fastest way to convert i32 to u8norm...
#asahi-gpu · 2021-04-11 16:03
bloom"Ewwwwwwww" was at AGX architecturally lacking support for basic vertex attributes.
#asahi-gpu · 2021-04-11 15:55
bloomand then the load 1 can be pipelined with the `do something with 0`
#asahi-gpu · 2021-04-11 15:55
bloom`load 0, load 1, wait 0, do something with 0, wait 1, do something with 1`
#asahi-gpu · 2021-04-11 15:55
bloomso the metal compiler can output code like
#asahi-gpu · 2021-04-11 15:55
bloomto allow a more fine grained scoreboarding
#asahi-gpu · 2021-04-11 15:55
bloomdougall: not sure if you've figured this out yet, but it looks like the `i` bit on wait corresponds to the `u2` immediate on device_Load
#asahi-gpu · 2021-04-11 15:52
bloomEwwwwwwww
#asahi-gpu · 2021-04-11 15:10
bloomThe ISA is regular enough and RA requirements simple enough it should be doable
#asahi-gpu · 2021-04-11 15:10
bloomintends on a full SSA backend compiler
#asahi-gpu · 2021-04-11 14:49
bloomYou really need push_exec in general, unless you can gurantee no divergence
#asahi-gpu · 2021-04-11 14:48
bloomdougall: After giving it some thought last night i believe this would work, but it would break if there was something after the loop before the else, etc
#asahi-gpu · 2021-04-11 04:21
bloomactualy, is it?
#asahi-gpu · 2021-04-11 04:16
bloombut I fully expect even if this works, it's a hack
#asahi-gpu · 2021-04-11 04:15
bloomif_icmp 1; * icmpsel r0l, #2, #0; update_exec; ....; jmp_exec_any *; else_cmp 1; ...; pop_exec 2;
#asahi-gpu · 2021-04-11 04:14
bloomdougall: for that particular example, I think you could do:
#asahi-gpu · 2021-04-11 03:56
bloomtries on pen/paper
#asahi-gpu · 2021-04-11 03:56
bloompeeling that back to Metal idioms will be one of the more memorable parts of compiler bringup ;)
#asahi-gpu · 2021-04-11 03:56
bloomso in NIR, we'd have `if { loop { if { break } foo } else { bar }`,
#asahi-gpu · 2021-04-11 03:56
bloomnod
#asahi-gpu · 2021-04-11 03:51
bloomyikes, ok, right. thanks, knew I was doing something wrong
#asahi-gpu · 2021-04-11 03:51
bloomohhhh
#asahi-gpu · 2021-04-11 03:50
bloompush_exec isn't documented but that's just a special case of if_icmp, ok
#asahi-gpu · 2021-04-11 03:49
bloomthe last pop should've been n=1, sorry
#asahi-gpu · 2021-04-11 03:48
bloomif icmpsel runs on a thread, by definition r0l = 0, so that's fine
#asahi-gpu · 2021-04-11 03:47
bloomer is it?
#asahi-gpu · 2021-04-11 03:47
bloomoh but that's broken for nested loops

plus ›