Skip to content

Commit 06198a5

Browse files
baoqiliucursoragent
andcommitted
[GCU] Remove unused checkGcuErrors and restore axpy operator logic
- Remove unused checkGcuErrors macro and __checkGcuErrors function from jit_utils.h; GCU error handling is centralized in gcu_backend.h - Remove unnecessary #include "tops_runtime_api.h" from jit_utils.h - Restore axpy3_kernel to original `o *= a` form, reverting the workaround that is no longer needed after fp64-to-fp32 signature conversion was implemented in standalone_compile.py Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 2998341 commit 06198a5

3 files changed

Lines changed: 3 additions & 16 deletions

File tree

examples/arg_handle/axpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def axpy3_kernel(X, Y, Out, a, n, BLOCK_N: tl.constexpr):
4141
x = tl.load(X + offsets, mask=mask)
4242
o = x
4343
if a is not None:
44-
o = o * a
44+
o *= a
4545

4646
if Y is not None:
4747
y = tl.load(Y + offsets, mask=mask)

examples/arg_handle/test_axpy.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "axpy_op.h"
33
#include "torch/torch.h"
44
#include "triton_jit/backend_config.h"
5+
56
static at::Device test_device() {
67
#if defined(BACKEND_NPU)
78
return at::Device("npu:0");

include/triton_jit/jit_utils.h

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#elif defined(BACKEND_MACA)
1818
#include <mcr/mc_runtime.h>
1919
#elif defined(BACKEND_GCU)
20-
#include "tops_runtime_api.h"
2120
#else
2221
#include "cuda.h"
2322
#endif
@@ -169,20 +168,7 @@ inline void __checkMacaErrors(mcError_t code, const char* file, const int line)
169168
}
170169
}
171170
#elif defined(BACKEND_GCU)
172-
#define checkGcuErrors(err) __checkGcuErrors(err, __FILE__, __LINE__)
173-
174-
inline void __checkGcuErrors(topsError_t code, const char* file, const int line) {
175-
if (code != topsSuccess) {
176-
const char* error_string = topsGetErrorString(code);
177-
fprintf(stderr,
178-
"GCU TOPS API error = %04d from file <%s>, line %i. Detail: <%s>\n",
179-
static_cast<int>(code),
180-
file,
181-
line,
182-
error_string);
183-
throw std::runtime_error(error_string ? error_string : "Unknown GCU error");
184-
}
185-
}
171+
// GCU error handling is done inline in gcu_backend.h
186172
#else
187173
void ensure_cuda_context();
188174

0 commit comments

Comments
 (0)