Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion tools/amd_build/build_amd.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,33 @@
'--add-static-casts',
action='store_true',
help="Whether to automatically add static_casts to kernel arguments.")

parser.add_argument(
'--project-directory',
type=str,
default='',
help="The root of the project.",
required=False)

parser.add_argument(
'--output-directory',
type=str,
default='',
help="The Directory to Store the Hipified Project",
required=False)

args = parser.parse_args()

amd_build_dir = os.path.dirname(os.path.realpath(__file__))
proj_dir = os.path.join(os.path.dirname(os.path.dirname(amd_build_dir)))

if args.project_directory:
proj_dir = args.project_directory

out_dir = proj_dir
if args.output_directory:
out_dir = args.output_directory

includes = [
"caffe2/operators/*",
"caffe2/sgd/*",
Expand Down Expand Up @@ -103,7 +125,7 @@

hipify_python.hipify(
project_directory=proj_dir,
output_directory=proj_dir,
output_directory=out_dir,
includes=includes,
ignores=ignores,
out_of_place_only=args.out_of_place_only,
Expand Down
12 changes: 5 additions & 7 deletions tools/amd_build/pyHIPIFY/hipify_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,17 +737,15 @@ def get_hip_file_path(filepath):
#
# - If the file name contains "CUDA", replace it with "HIP", AND
#
# If NONE of the above occurred, then append "_hip" to the end of
# the filename (before the extension).
# If NONE of the above occurred, then insert "hip" in the file path
# as the direct parent folder of the file
#
# Furthermore, ALWAYS replace '.cu' with '.hip'.
# Furthermore, ALWAYS replace '.cu' with '.hip', because those files
# contain CUDA kernels that needs to be hipified and processed with
# hcc compiler
#
# This isn't set in stone; we might adjust this to support other
# naming conventions.
#
# In the near future, we intend to also change cu/cuh file extension
# to hcc/hcch rather than cc; however, the hcc compiler does not
# currently support this file extension.

if ext == '.cu':
ext = '.hip'
Expand Down