Skip to content

Commit b93c7a2

Browse files
authored
[ROCm] Fix subprocess error (#6587)
Fixes #6585 Use shell=True for subprocess.check_output() in case of ROCm commands. Do not use shlex.split() since command string has wildcard expansion. Signed-off-by: Jagadish Krishnamoorthy <jagadish.krishnamoorthy@amd.com>
1 parent 8cded57 commit b93c7a2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

op_builder/builder.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,7 @@ def get_rocm_gpu_arch():
253253
rocm_info = Path("rocminfo")
254254
rocm_gpu_arch_cmd = str(rocm_info) + " | grep -o -m 1 'gfx.*'"
255255
try:
256-
safe_cmd = shlex.split(rocm_gpu_arch_cmd)
257-
result = subprocess.check_output(safe_cmd)
256+
result = subprocess.check_output(rocm_gpu_arch_cmd, shell=True)
258257
rocm_gpu_arch = result.decode('utf-8').strip()
259258
except subprocess.CalledProcessError:
260259
rocm_gpu_arch = ""
@@ -272,8 +271,7 @@ def get_rocm_wavefront_size():
272271
rocm_wavefront_size_cmd = str(
273272
rocm_info) + " | grep -Eo -m1 'Wavefront Size:[[:space:]]+[0-9]+' | grep -Eo '[0-9]+'"
274273
try:
275-
safe_cmd = shlex.split(rocm_wavefront_size_cmd)
276-
result = subprocess.check_output(rocm_wavefront_size_cmd)
274+
result = subprocess.check_output(rocm_wavefront_size_cmd, shell=True)
277275
rocm_wavefront_size = result.decode('utf-8').strip()
278276
except subprocess.CalledProcessError:
279277
rocm_wavefront_size = "32"

0 commit comments

Comments
 (0)