Skip to content

Commit 5c9393a

Browse files
authored
[AMD] Refine handling kpack parameter for gfx950 (#7518)
Current implementation reports an assert error if `kpack != 1` is used for MI350. One problem is many legacy code on MI300 has the value `kpack = 2`. When running them on MI350, an assert error is reported, and users need to change all places where `kpack = 2` is used. To avoid the problem, if `kpack = 2` is used on MI350, we will issue a warning message and overwrite it to 1 internally. So users are aware of the problem, but do not have to change their source code.
1 parent 1cf8daf commit 5c9393a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

third_party/amd/backend/compiler.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import re
1010
import subprocess
1111
import functools
12+
import warnings
1213
from pathlib import Path
1314

1415

@@ -73,8 +74,11 @@ def __post_init__(self):
7374
assert self.num_warps > 0 and (self.num_warps & (self.num_warps - 1)) == 0, \
7475
"num_warps must be a power of 2"
7576

76-
if self.arch == 'gfx950':
77-
assert self.kpack == 1, "gfx950 only accepts kpack == 1"
77+
if (self.arch == 'gfx950') and (self.kpack != 1):
78+
warnings.warn(
79+
f"kpack is deprecated starting from gfx950 and will be removed in later releases. So for now kpack = {self.kpack} will be overwritten to 1 to make transitioning easier."
80+
)
81+
object.__setattr__(self, 'kpack', 1)
7882

7983
default_libdir = Path(__file__).parent / 'lib'
8084
extern_libs = {} if self.extern_libs is None else dict(self.extern_libs)

0 commit comments

Comments
 (0)