Skip to content

Conversation

@iotamudelta
Copy link
Contributor

As discussed in call, this will allow us to keep this integral part of the effort to run PyTorch on ROCm in sync with the main code.

Copy link
Contributor

@bddppq bddppq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for merging these python scripts into pytorch repo.
The CI failure is python code lint check, you can use autopep8 to automatically make them conforming the style requirements.

#!/usr/bin/python
""" The Python Hipify script.
##
# Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@soumith
Copy link
Contributor

soumith commented Jun 23, 2018

the script is failing lint

@dagamayank dagamayank mentioned this pull request Jun 24, 2018
"--output-directory", proj_dir,
"--include-dirs"] + include_dirs + ["--yaml-settings", yaml_file, "--add-static-casts", "True"]
os.execv("/opt/rocm/bin/hipify-python.py", ['python'] + args)
os.execv(os.path.join(amd_build_dir, "pyHIPIFY", "hipify-python.py"), ['python'] + args)

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -0,0 +1,47 @@
CONV_VERSION = 0,

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -0,0 +1,2097 @@
from constants import *

CUDA_TYPE_NAME_MAP = {

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

"CU_RES_VIEW_FORMAT_FLOAT_2X16": ("hipResViewFormatHalf2", CONV_TEX,API_DRIVER),
"CU_RES_VIEW_FORMAT_FLOAT_4X16": ("hipResViewFormatHalf4", CONV_TEX,API_DRIVER),
"CU_RES_VIEW_FORMAT_FLOAT_1X32": ("hipResViewFormatFloat1", CONV_TEX,API_DRIVER),
"CU_RES_VIEW_FORMAT_FLOAT_2X32": ("hipResVi

This comment was marked as off-topic.


# Update the progress
print(os.path.join(dirpath, filename))
update_progress_bar(total_files, current_file)

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.


def openf(filename, mode):
if sys.version_info[0] == 3:
return open(filename, mode, errors='ignore')

This comment was marked as off-topic.

status)

# Send the progress to stdout.
sys.stdout.write(text)

This comment was marked as off-topic.

This comment was marked as off-topic.


def filename_ends_with_extension(filename, extensions):
"""Helper method to see if filename ends with certain extension"""
return reduce(lambda result, ext: filename.endswith("." + ext) or result, extensions, False)

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

def processKernelLaunches(string, stats):
""" 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.sub(r'([ ]+)(detail+)::[ ]+\\\n[ ]+', lambda inp: "%s%s::" % (inp.group(1), inp.group(2)), string)

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

return output_string


def find_paranthesis_end(input_string, start):

This comment was marked as off-topic.

This comment was marked as off-topic.

Jorghi12 and others added 6 commits July 10, 2018 16:56
String inputs should have meta characters escaped prior to using them with regular expressions.
The inputs into the regular expressions must have their meta characters escaped or unexpected replacements may occur.
test
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bddppq has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

facebook-github-bot pushed a commit that referenced this pull request Jul 18, 2018
Summary:
This PR contains the ROCm contributions of last week:
* documentation of pyHIPIFY data format originating from #8812 reviewing comments by ezyang
* removal of most patch files from the `amd_build` directory and integration into the code base
* enabling of previously disabled_features that do compile now
* improvement to the static_cast feature in pyHIPIFY (it will only apply static_cast to kernel arguments, not launch arguments)
* addition of two workarounds to pyHIPIFY for ROCm/HIP shortcomings: a) `__forceinline__` does not imply `static`, hence change to `__inline__`, b) `std::[exp,log,pow]` math functions cannot be selected in device code, use `::[exp,log,pow]` instead. Both of these workarounds will be removed once the issues are fixed upstream. Neither of these issues have surfaced on the CI but were reproduced internally.
Pull Request resolved: #9432

Differential Revision: D8887441

Pulled By: ezyang

fbshipit-source-id: 71cf5c6b13772a66d10be369a45ebf06e4e268e1
jramseyer pushed a commit to jramseyer/pytorch that referenced this pull request Jul 30, 2018
Summary:
This PR contains the ROCm contributions of last week:
* documentation of pyHIPIFY data format originating from pytorch#8812 reviewing comments by ezyang
* removal of most patch files from the `amd_build` directory and integration into the code base
* enabling of previously disabled_features that do compile now
* improvement to the static_cast feature in pyHIPIFY (it will only apply static_cast to kernel arguments, not launch arguments)
* addition of two workarounds to pyHIPIFY for ROCm/HIP shortcomings: a) `__forceinline__` does not imply `static`, hence change to `__inline__`, b) `std::[exp,log,pow]` math functions cannot be selected in device code, use `::[exp,log,pow]` instead. Both of these workarounds will be removed once the issues are fixed upstream. Neither of these issues have surfaced on the CI but were reproduced internally.
Pull Request resolved: pytorch#9432

Differential Revision: D8887441

Pulled By: ezyang

fbshipit-source-id: 71cf5c6b13772a66d10be369a45ebf06e4e268e1
goodlux pushed a commit to goodlux/pytorch that referenced this pull request Aug 15, 2018
…h#8812)

Summary:
As discussed in call, this will allow us to keep this integral part of the effort to run PyTorch on ROCm in sync with the main code.
Pull Request resolved: pytorch#8812

Reviewed By: ezyang

Differential Revision: D8796245

Pulled By: bddppq

fbshipit-source-id: 8e12c2acf6a7e0740f31b21e50be74e10ed8b12c
goodlux pushed a commit to goodlux/pytorch that referenced this pull request Aug 15, 2018
Summary:
This PR contains the ROCm contributions of last week:
* documentation of pyHIPIFY data format originating from pytorch#8812 reviewing comments by ezyang
* removal of most patch files from the `amd_build` directory and integration into the code base
* enabling of previously disabled_features that do compile now
* improvement to the static_cast feature in pyHIPIFY (it will only apply static_cast to kernel arguments, not launch arguments)
* addition of two workarounds to pyHIPIFY for ROCm/HIP shortcomings: a) `__forceinline__` does not imply `static`, hence change to `__inline__`, b) `std::[exp,log,pow]` math functions cannot be selected in device code, use `::[exp,log,pow]` instead. Both of these workarounds will be removed once the issues are fixed upstream. Neither of these issues have surfaced on the CI but were reproduced internally.
Pull Request resolved: pytorch#9432

Differential Revision: D8887441

Pulled By: ezyang

fbshipit-source-id: 71cf5c6b13772a66d10be369a45ebf06e4e268e1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants