1876127044972728402, 1876147238508138659

This commit is contained in:
ed committed 2026-08-25 21:59:10 -04:00
1 parent baf931947b
commit c2f0e52b35
3 files changed
+84

No files matched your search

@@ -0,0 +1,37 @@
---
title: "After a few hours of trying workaround and seeing a whole lot of perf bugs in the process."
type: archive
source: twitter
source_url: "https://x.com/NOTimothyLottes/status/1876127044972728402"
author: "NOTimothyLottes"
handle: NOTimothyLottes
post_id: "1876127044972728402"
date: 2025-01-06
archived: 2026-08-25
draft: false
tags:
- archive
- twitter
- NOTimothyLottes
description: "After a few hours of trying workaround and seeing a whole lot of perf bugs in the process."
in_reply_to: ""
parent_post_id: "1876120138283729159"
---
## Source
- URL: https://x.com/NOTimothyLottes/status/1876127044972728402
- Author: NOTimothyLottes (@NOTimothyLottes)
- Posted: 2025-01-06 04:41:58
## Branch
**1/** **@NOTimothyLottes** ^1876127044972728402
After a few hours of trying workaround and seeing a whole lot of perf bugs in the process. The irony is this is just a trivial HEX dump print shader. And if I can find this many problems in just one shader, image how many you'd find in a whole application!
![](https://pbs.twimg.com/media/GglXeRrXsAAU2aW?format=png&name=orig)
## Related
- Spine: [[archive/threads/NOTimothyLottes/2025-01-06-one-of-the-downsides-of-v-cndmask-b32-on-amd-is]]
@@ -0,0 +1,43 @@
---
title: "@NOTimothyLottes GLSL bitfieldInsert does something else?"
type: archive
source: twitter
source_url: "https://x.com/axelgneiting/status/1876147238508138659"
author: "Axel Gneiting"
handle: axelgneiting
post_id: "1876147238508138659"
date: 2025-01-06
archived: 2026-08-25
draft: false
tags:
- archive
- twitter
- NOTimothyLottes
description: "@NOTimothyLottes GLSL bitfieldInsert does something else?"
in_reply_to: ""
parent_post_id: "1876112593510949253"
---
## Source
- URL: https://x.com/axelgneiting/status/1876147238508138659
- Author: Axel Gneiting (@axelgneiting)
- Posted: 2025-01-06 06:02:13
## Branch
**1/** **@axelgneiting** ^1876147238508138659
**@NOTimothyLottes**
GLSL bitfieldInsert does something else?
**2/** **@NOTimothyLottes** ^1876152977704247326
**@axelgneiting**
Yeah the GLSL bitfieldInsert() and V_BFI_B32 are different. The HW instruction supports an arbitrary bitmask instead of one generated from just {offset, size}
## Related
- Spine: [[archive/threads/NOTimothyLottes/2025-01-06-one-of-the-downsides-of-v-cndmask-b32-on-amd-is]]
@@ -50,12 +50,16 @@ One of my favorite AMD instructions V_BFI_B32 is unfortunately one that no intri
![](https://pbs.twimg.com/media/GglKA6nW4AEtOIC?format=png&name=orig)
![](https://pbs.twimg.com/media/GglKXy4XcAAA_Og?format=png&name=orig)
Branches: [[archive/threads/NOTimothyLottes/2025-01-06-one-of-the-downsides-of-v-cndmask-b32-on-amd-is/2025-01-06-axelgneiting-glsl-bitfieldinsert-does-something-else]]
**5/** **@NOTimothyLottes** ^1876120138283729159
Just looking at the next 5 lines of disassembly shows another 2 perf bugs: the compiler transforms 3 operations into 5 operations because it cannot handle mixed packed and unpacked stuff. The 2 V_ANDs can be merged, and the LSHL and CVT should just be one op
![](https://pbs.twimg.com/media/GglQsALXYAAEfWI?format=png&name=orig)
Branches: [[archive/threads/NOTimothyLottes/2025-01-06-one-of-the-downsides-of-v-cndmask-b32-on-amd-is/2025-01-06-NOTimothyLottes-after-a-few-hours-of-trying-workaround-and-seeing]]
**6/** **@NOTimothyLottes** ^1876126316816380333
No way to work around those problems. Looks like bitfieldExtract 'v4' back-propagates something where the compiler ignores the .y in the packed logic, and then makes a mess of things scalarizing it. BFE only uses the 5-bit LSB of 'v4', so it's safe to leave junk in the other bits