Skip to content

Commit d7f3f6b

Browse files
committed
use get_dm
1 parent dc898ca commit d7f3f6b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

ggml/src/ggml-vulkan/vulkan-shaders/dequant_funcs.glsl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,18 @@ vec4 dequantize4(uint ib, uint iqs, uint a_offset) {
8989

9090
#if defined(DATA_A_Q1_0)
9191
vec2 dequantize(uint ib, uint iqs, uint a_offset) {
92-
const float d = float(data_a[a_offset + ib].d);
9392
const uint bits = uint(data_a[a_offset + ib].qs[iqs / 8u]) >> (iqs % 8u);
9493
return vec2(
95-
(bits & 1u) != 0u ? d : -d,
96-
(bits & 2u) != 0u ? d : -d);
94+
(bits & 1u) != 0u ? 1.0f : -1.0f,
95+
(bits & 2u) != 0u ? 1.0f : -1.0f);
9796
}
9897
vec4 dequantize4(uint ib, uint iqs, uint a_offset) {
99-
const float d = float(data_a[a_offset + ib].d);
10098
const uint bits = uint(data_a[a_offset + ib].qs[iqs / 8u]) >> (iqs % 8u);
10199
return vec4(
102-
(bits & 1u) != 0u ? d : -d,
103-
(bits & 2u) != 0u ? d : -d,
104-
(bits & 4u) != 0u ? d : -d,
105-
(bits & 8u) != 0u ? d : -d);
100+
(bits & 1u) != 0u ? 1.0f : -1.0f,
101+
(bits & 2u) != 0u ? 1.0f : -1.0f,
102+
(bits & 4u) != 0u ? 1.0f : -1.0f,
103+
(bits & 8u) != 0u ? 1.0f : -1.0f);
106104
}
107105
#endif
108106

@@ -475,7 +473,8 @@ vec2 get_dm(uint ib, uint a_offset) {
475473

476474
#if defined(DATA_A_Q1_0)
477475
vec2 get_dm(uint ib, uint a_offset) {
478-
return vec2(1, 0);
476+
const float d = float(data_a[a_offset + ib].d);
477+
return vec2(d, 0);
479478
}
480479
#endif
481480

0 commit comments

Comments
 (0)