Skip to content

Commit 640e207

Browse files
authored
Update types.comp
1 parent 5c3201d commit 640e207

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ggml/src/ggml-vulkan/vulkan-shaders/types.comp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,9 +1423,8 @@ float e8m0_to_fp32(uint8_t x) {
14231423
// }
14241424

14251425
// branchless optimization
1426-
uint ux = uint(x);
1427-
uint is_zero = uint(x == 0);
1428-
uint result = (ux << 23) * (1 - is_zero) + (0x00400000u * is_zero);
1426+
uint is_zero = uint(x == 0);
1427+
uint result = (uint(x) << 23) | (is_zero << 22);
14291428
return uintBitsToFloat(result);
14301429
}
14311430

0 commit comments

Comments
 (0)