The robot and I are working through the tests for vllm_gguf_plugin. Several of the IQ and K quant kernels failed tests on my gfx1100 GPUs. Here’s an example of what the robot did to iq1_s.py.
The current code nests the il loop inside the ib loop, and accumulates.
for kb in range(0, num_k_blocks):
...
for ib in range(8):
...
for il in range(4): # five casts .to(x_dtype) in here
# d is redundantly assigned 32 times per kb loop
d = load_f16_from_u8(block_ptrs + 0, n_mask).to(x_dtype)
...
acc += tl.sum(x_tile[:, None, :] * q_tile[None, :, :], axis=2)
...
The new code works mostly in float32. It removes the il loop and instead uses tl.dot(). It assigns d once per kb loop.
for kb in range(0, num_k_blocks):
...
# load d directly cast into float32, before the ib loop
d = load_f16_from_u8(block_ptrs + 0, n_mask).to(tl.float32)
...
for ib in range(8):
...
# the only cast .to(x_dtype)
q_tile = ((grid * 8 + delta_num[:, None]) * scale[:, None]).to(x_dtype)
# the il loop is removed, tl.dot() instead
acc = tl.dot(x_tile, tl.trans(q_tile), acc=acc)
...
The tests pass now, and I got some performance improvement. However, I don’t know how to test that my changes are valid, and don’t cause regressions for everyone else. I’m not good enough yet to judge if these changes are slop.