summarylogtreecommitdiffstats
path: root/rocm-6.0.patch
blob: aa0f406177cbb8652cf21409b734cbbd377e3ff3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
diff --git a/cupy_backends/cuda/api/_runtime_typedef.pxi b/cupy_backends/cuda/api/_runtime_typedef.pxi
--- a/cupy_backends/cuda/api/_runtime_typedef.pxi	(revision a384b1ad0098a34a6613766ee04459fbf7b56dd9)
+++ b/cupy_backends/cuda/api/_runtime_typedef.pxi	(revision 39382bab4c85b92ac2a33e603471faed63c39003)
@@ -138,9 +138,15 @@
             int device
             void* devicePointer
             void* hostPointer
-    ELIF CUPY_HIP_VERSION > 0:
+    ELIF 0 < CUPY_HIP_VERSION < 600:
         ctypedef struct _PointerAttributes 'cudaPointerAttributes':
             int memoryType
+            int device
+            void* devicePointer
+            void* hostPointer
+    ELIF CUPY_HIP_VERSION >= 600:
+        ctypedef struct _PointerAttributes 'cudaPointerAttributes':
+            int type
             int device
             void* devicePointer
             void* hostPointer
diff --git a/cupy_backends/cuda/api/runtime.pyx b/cupy_backends/cuda/api/runtime.pyx
--- a/cupy_backends/cuda/api/runtime.pyx	(revision a384b1ad0098a34a6613766ee04459fbf7b56dd9)
+++ b/cupy_backends/cuda/api/runtime.pyx	(revision 39382bab4c85b92ac2a33e603471faed63c39003)
@@ -318,7 +318,6 @@
         properties['clockInstructionRate'] = props.clockInstructionRate
         properties['maxSharedMemoryPerMultiProcessor'] = (
             props.maxSharedMemoryPerMultiProcessor)
-        properties['gcnArch'] = props.gcnArch
         properties['hdpMemFlushCntl'] = <intptr_t>(props.hdpMemFlushCntl)
         properties['hdpRegFlushCntl'] = <intptr_t>(props.hdpRegFlushCntl)
         properties['memPitch'] = props.memPitch
@@ -351,6 +350,8 @@
         arch['has3dGrid'] = props.arch.has3dGrid
         arch['hasDynamicParallelism'] = props.arch.hasDynamicParallelism
         properties['arch'] = arch
+    IF CUPY_HIP_VERSION < 600: # removed in HIP 6.0.0
+        properties['gcnArch'] = props.gcnArch
     IF CUPY_HIP_VERSION >= 310:
         properties['gcnArchName'] = props.gcnArchName
         properties['asicRevision'] = props.asicRevision
@@ -720,12 +721,18 @@
             <intptr_t>attrs.devicePointer,
             <intptr_t>attrs.hostPointer,
             attrs.type)
-    ELIF CUPY_HIP_VERSION > 0:
+    ELIF 0 < CUPY_HIP_VERSION < 600:
         return PointerAttributes(
             attrs.device,
             <intptr_t>attrs.devicePointer,
             <intptr_t>attrs.hostPointer,
             attrs.memoryType)
+    ELIF CUPY_HIP_VERSION >= 600:
+        return PointerAttributes(
+            attrs.device,
+            <intptr_t>attrs.devicePointer,
+            <intptr_t>attrs.hostPointer,
+            attrs.type)
     ELSE:  # for RTD
         return None

diff --git a/cupy_backends/hip/cupy_hip_runtime.h b/cupy_backends/hip/cupy_hip_runtime.h
--- a/cupy_backends/hip/cupy_hip_runtime.h	(revision a384b1ad0098a34a6613766ee04459fbf7b56dd9)
+++ b/cupy_backends/hip/cupy_hip_runtime.h	(revision 6304091cb4ed73698e360d7695b6ee035d17cd61)
@@ -270,13 +270,23 @@
                                      const void* ptr) {
     cudaError_t status = hipPointerGetAttributes(attributes, ptr);
     if (status == cudaSuccess) {
-        switch (attributes->memoryType) {
+#if HIP_VERSION >= 600
+        switch (attributes->type) {
+            case 0 /* hipMemoryTypeHost */:
+                attributes->type = (hipMemoryType)1; /* cudaMemoryTypeHost */
+                return status;
+            case 1 /* hipMemoryTypeDevice */:
+                attributes->type = (hipMemoryType)2; /* cudaMemoryTypeDevice */
+                return status;
+#else
+       switch (attributes->memoryType) {
             case 0 /* hipMemoryTypeHost */:
                 attributes->memoryType = (hipMemoryType)1; /* cudaMemoryTypeHost */
                 return status;
             case 1 /* hipMemoryTypeDevice */:
                 attributes->memoryType = (hipMemoryType)2; /* cudaMemoryTypeDevice */
                 return status;
+#endif
             default:
                 /* we don't care the rest of possibilities */
                 return status;
diff --git a/install/cupy_builder/install_build.py b/install/cupy_builder/install_build.py
--- a/install/cupy_builder/install_build.py	(revision a384b1ad0098a34a6613766ee04459fbf7b56dd9)
+++ b/install/cupy_builder/install_build.py	(revision 39382bab4c85b92ac2a33e603471faed63c39003)
@@ -155,6 +155,11 @@
         include_dirs.append(os.path.join(rocm_path, 'include', 'rocrand'))
         include_dirs.append(os.path.join(rocm_path, 'include', 'hiprand'))
         include_dirs.append(os.path.join(rocm_path, 'include', 'roctracer'))
+        include_dirs.append(os.path.join(rocm_path, 'include', 'hipblas'))
+        include_dirs.append(os.path.join(rocm_path, 'include', 'hipsparse'))
+        include_dirs.append(os.path.join(rocm_path, 'include', 'hipfft'))
+        include_dirs.append(os.path.join(rocm_path, 'include', 'rocsolver'))
+        include_dirs.append(os.path.join(rocm_path, 'include', 'rccl'))
         library_dirs.append(os.path.join(rocm_path, 'lib'))

     if use_hip:
Index: cupy_backends/cuda/libs/_cnvrtc.pxi
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/cupy_backends/cuda/libs/_cnvrtc.pxi b/cupy_backends/cuda/libs/_cnvrtc.pxi
--- a/cupy_backends/cuda/libs/_cnvrtc.pxi	(revision 8a6754773c21338c1cef770ca73af27fa50ef88a)
+++ b/cupy_backends/cuda/libs/_cnvrtc.pxi	(revision 6304091cb4ed73698e360d7695b6ee035d17cd61)
@@ -139,5 +139,8 @@
         elif runtime_version < 6_00_00000:
             # ROCm 5.x
             libname = 'libamdhip64.so.5'
+        elif runtime_version < 7_00_00000:
+            # ROCm 6.x
+            libname = 'libamdhip64.so.6'

     return SoftLink(libname, prefix, mandatory=True)