Skip to content

Commit

Permalink
gloo
Browse files Browse the repository at this point in the history
Reviewed By: jermenkoo

Differential Revision: D63971820

fbshipit-source-id: fccf221defb437dd8a39f2de4c0fc3cca1fd1094
  • Loading branch information
generatedunixname89002005287564 authored and facebook-github-bot committed Oct 7, 2024
1 parent a5c386a commit 9a6b9dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion tools/amd_build/build_amd.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env python3

from __future__ import absolute_import, division, print_function

import argparse
import os
Expand Down
13 changes: 5 additions & 8 deletions tools/amd_build/pyHIPIFY/hipify_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
# THE SOFTWARE.
"""

from __future__ import absolute_import, division, print_function

import fnmatch
import os
Expand All @@ -37,7 +36,7 @@ class InputError(Exception):
# Exception raised for errors in the input.

def __init__(self, message):
super(InputError, self).__init__(message)
super().__init__(message)
self.message = message

def __str__(self):
Expand Down Expand Up @@ -128,8 +127,8 @@ def add_dim3(kernel_string, cuda_kernel):
.strip(" ")
)

first_arg_dim3 = "dim3({})".format(first_arg_clean)
second_arg_dim3 = "dim3({})".format(second_arg_clean)
first_arg_dim3 = f"dim3({first_arg_clean})"
second_arg_dim3 = f"dim3({second_arg_clean})"

first_arg_raw_dim3 = first_arg_raw.replace(first_arg_clean, first_arg_dim3)
second_arg_raw_dim3 = second_arg_raw.replace(second_arg_clean, second_arg_dim3)
Expand All @@ -145,9 +144,7 @@ def add_dim3(kernel_string, cuda_kernel):
def processKernelLaunches(string):
"""Replace the CUDA style Kernel launches with the HIP style kernel launches."""
# Concat the namespace with the kernel names. (Find cleaner way of doing this later).
string = RE_KERNEL_LAUNCH.sub(
lambda inp: "{0}{1}::".format(inp.group(1), inp.group(2)), string
)
string = RE_KERNEL_LAUNCH.sub(lambda inp: f"{inp.group(1)}{inp.group(2)}::", string)

def grab_method_and_template(in_kernel):
# The positions for relevant kernel components.
Expand Down Expand Up @@ -388,7 +385,7 @@ def sub_repl(m):
def preprocessor(project_directory, output_directory, filepath):
"""Executes the CUDA -> HIP conversion on the specified file."""
fin_path = os.path.join(project_directory, filepath)
with open(fin_path, "r") as fin:
with open(fin_path) as fin:
output_source = fin.read()

fout_path = os.path.join(output_directory, get_hip_file_path(filepath))
Expand Down

0 comments on commit 9a6b9dc

Please sign in to comment.