Skip to content

Commit 37f2659

Browse files
authored
[amd][driver] fix _PyFloat_Pack2 for Python 3.10 (#7879)
Fixing Python 3.10 build error on AMD: ``` E 95 | if (code != HIP_SUCCESS) E | ~~~~ ^ ~~~~~~~~~~~ E __triton_launcher.c:172:5: error: no matching function for call to '_PyFloat_Pack2' E 172 | _PyFloat_Pack2(f, (char*)&result, 1); E | ^~~~~~~~~~~~~~ E note: candidate function not viable: no known conversion from 'char *' to 'unsigned char *' for 2nd argument E 87 | PyAPI_FUNC(int) _PyFloat_Pack2(double x, unsigned char *p, int le); ```
1 parent 283e5a2 commit 37f2659

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

third_party/amd/backend/driver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,9 @@ def format_of(ty):
474474
475475
static uint16_t pack_fp16(double f) {{
476476
uint16_t result;
477-
// from https://github.com/python/pythoncapi-compat
477+
// from https://github.com/python/pythoncapi-compat/blob/5e317108f872c904eb726cb8d560dcadbdf88a72/pythoncapi_compat.h#L482-L492
478478
#if 0x030600B1 <= PY_VERSION_HEX && PY_VERSION_HEX <= 0x030B00A1 && !defined(PYPY_VERSION)
479-
_PyFloat_Pack2(f, (char*)&result, 1);
479+
_PyFloat_Pack2(f, (unsigned char*)&result, 1);
480480
#else
481481
PyFloat_Pack2(f, (char*)&result, 1);
482482
#endif

0 commit comments

Comments
 (0)