Skip to content

Commit 12785be

Browse files
committed
assert trivially copyable type
1 parent fe281f4 commit 12785be

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

include/triton_jit/triton_kernel.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@ class TritonJITFunction;
1313

1414
template <typename T>
1515
T get_next_multiple_of(T pos, T step) {
16-
if (pos % step == 0) return pos;
17-
18-
while (pos % step) {
19-
pos++;
20-
}
21-
return pos;
16+
return ((pos + step - 1) / step) * step;
2217
}
2318

2419
struct ParameterBuffer {
@@ -34,6 +29,7 @@ struct ParameterBuffer {
3429

3530
template <typename T>
3631
void push_arg(T &&v) {
32+
static_assert(std::is_trivially_copyable_v<std::remove_reference_t<T>>, "Non trivially copyable type");
3733
size_t align = alignof(T);
3834
size_t offset = get_next_multiple_of(this->cursor_, align);
3935
this->offsets_.push_back(offset);

0 commit comments

Comments
 (0)