Skip to content

Windows Support for hip#13

Open
dc-dc-dc wants to merge 9 commits into
tinygrad:masterfrom
dc-dc-dc:hip_windows
Open

Windows Support for hip#13
dc-dc-dc wants to merge 9 commits into
tinygrad:masterfrom
dc-dc-dc:hip_windows

Conversation

@dc-dc-dc

Copy link
Copy Markdown

Added windows support for hip

  • Changed test helper name cuda_compile -> compile
  • Added arg for filename to compile
  • Added LIB_HIP, LIB_HIPRTC constants to gpuctypes/hip.py
  • Changed the library lookup to use a the string constants

@dc-dc-dc

Copy link
Copy Markdown
Author

wait, is the goal to have the changes in the generate scripts?

@geohot

geohot commented Nov 26, 2023

Copy link
Copy Markdown
Contributor

I meant to call it cuda_compile, compile is a reserved keyword in Python

@geohot

geohot commented Nov 26, 2023

Copy link
Copy Markdown
Contributor

Err, and you can't really modify gpuctypes/hip.py, yea, it needs to be in the script.

@dc-dc-dc

Copy link
Copy Markdown
Author

yeah redoing to inject it from the script

@geohot

geohot commented Nov 26, 2023

Copy link
Copy Markdown
Contributor

The script injection stuff really needs to be cleaned up if it's going to be more than a one line change

Comment thread test/helpers.py Outdated
Comment thread test/test_hip.py Outdated

def test_compile(self):
prg = cuda_compile("int test() { return 42; }", ["--offload-arch=gfx1100"], HIPCompile, check)
prg = compile("int test() { return 42; }", ["--offload-arch=gfx1100"], HIPCompile, check, filename=None)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Windows isn't okay with <null>?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

it would throw an error about the profiler not being initialized, not sure how the filename relates to it tho but can debug when I have some spare time

@geohot

geohot commented Nov 26, 2023

Copy link
Copy Markdown
Contributor

#14 should make CI fail if the autogeneration doesn't match

@geohot

geohot commented Nov 26, 2023

Copy link
Copy Markdown
Contributor

The LIB_HIPRTC change also shouldn't matter. The dict name can still be .so on Windows

@dc-dc-dc

Copy link
Copy Markdown
Author

fixed CI error

Comment thread gpuctypes/hip.py
if 'linux' in sys.platform:
return ctypes.CDLL(os.path.join('/opt/rocm/lib/libhiprtc.so'))
elif 'win' in sys.platform:
hip_path = os.getenv('HIP_PATH', None)

@geohot geohot Nov 29, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a way to not need this? How come it can find amdhip64?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

amdhip64 gets installed in System32 where cdll searches for dlls, the rtc does not so have to use HIP_PATH to find the hip installation. HIP_PATH is added to the env on install of the hip sdk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants