Skip to content

Commit

Permalink
[ROCm] Fix subprocess error (#6587)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jagadish-amd authored Oct 4, 2024
1 parent 8cded57 commit b93c7a2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions op_builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ def get_rocm_gpu_arch():
rocm_info = Path("rocminfo")
rocm_gpu_arch_cmd = str(rocm_info) + " | grep -o -m 1 'gfx.*'"
try:
safe_cmd = shlex.split(rocm_gpu_arch_cmd)
result = subprocess.check_output(safe_cmd)
result = subprocess.check_output(rocm_gpu_arch_cmd, shell=True)
rocm_gpu_arch = result.decode('utf-8').strip()
except subprocess.CalledProcessError:
rocm_gpu_arch = ""
Expand All @@ -272,8 +271,7 @@ def get_rocm_wavefront_size():
rocm_wavefront_size_cmd = str(
rocm_info) + " | grep -Eo -m1 'Wavefront Size:[[:space:]]+[0-9]+' | grep -Eo '[0-9]+'"
try:
safe_cmd = shlex.split(rocm_wavefront_size_cmd)
result = subprocess.check_output(rocm_wavefront_size_cmd)
result = subprocess.check_output(rocm_wavefront_size_cmd, shell=True)
rocm_wavefront_size = result.decode('utf-8').strip()
except subprocess.CalledProcessError:
rocm_wavefront_size = "32"
Expand Down

0 comments on commit b93c7a2

Please sign in to comment.