Skip to content

Commit a70655f

Browse files
committed
adds kUnknown type, sizes half properly
1 parent f988a0b commit a70655f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

gpu.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ enum NumType {
204204
ku16,
205205
ku32,
206206
ku64,
207+
kUnknown
207208
};
208209

209210
/**
@@ -212,15 +213,15 @@ enum NumType {
212213
inline size_t sizeBytes(const NumType &type) {
213214
switch (type) {
214215
case kf16:
215-
return sizeof(uint16_t);
216+
return sizeof(half);
216217
case kf32:
217218
return sizeof(float);
218219
case kf64:
219220
return sizeof(double);
220221
case ki8:
221-
return sizeof(uint8_t);
222+
return sizeof(int8_t);
222223
case ki16:
223-
return sizeof(uint16_t);
224+
return sizeof(int16_t);
224225
case ki32:
225226
return sizeof(int32_t);
226227
case ki64:

test/test_gpu.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ void testAddKernelInt8() {
218218
Kernel unpackKernelB =
219219
createKernel(ctx, {kPackedInt8ToInt32Kernel, workgroupSize, ki32},
220220
Bindings{bTensorPacked, bTensorUnpacked},
221-
{cdiv(packedCount, workgroupSize), 1,
222-
1});
221+
{cdiv(packedCount, workgroupSize), 1, 1});
223222
// Dispatch based on packed size
224223
dispatchKernel(ctx, unpackKernelA);
225224
dispatchKernel(ctx, unpackKernelB);
@@ -245,8 +244,6 @@ void testAddKernelInt8() {
245244
toCPU(ctx, outputTensorPacked, ki8, result.data(), 0);
246245

247246
for (size_t i = 0; i < N; ++i) {
248-
LOG(kDefLog, kInfo, "result[%zu] = %d, expected[%zu] = %d", i, result[i], i,
249-
expected[i]);
250247
assert(result[i] == expected[i]);
251248
}
252249

0 commit comments

Comments
 (0)