forked from dereklstinson/hip
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevice_DeviceProp.go
More file actions
236 lines (184 loc) · 6.99 KB
/
device_DeviceProp.go
File metadata and controls
236 lines (184 loc) · 6.99 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
package hip
//#include <hip/hip_runtime_api.h>
import "C"
//DeviceProp is a binding for C.hipDeviceProp_t. Subvalues are accessed through DeviceProp's methods
type DeviceProp C.hipDeviceProp_t
func (d DeviceProp) c() C.hipDeviceProp_t { return (C.hipDeviceProp_t)(d) }
func (d *DeviceProp) cptr() *C.hipDeviceProp_t { return (*C.hipDeviceProp_t)(d) }
//Name - Device name
func (d *DeviceProp) Name() string {
return C.GoString(&d.name[0])
}
//Arch returns the DeviceArch struct.
func (d *DeviceProp) Arch() DeviceArch {
return (DeviceArch)(d.arch)
}
//TotalGlobalMem - size of globalmemory region in bytes
func (d *DeviceProp) TotalGlobalMem() uint {
return (uint)(d.totalGlobalMem)
}
//SharedMemPerBlock -Size of shared memory region (in bytes)
func (d *DeviceProp) SharedMemPerBlock() uint {
return (uint)(d.sharedMemPerBlock)
}
//MaxSharedMemoryPerMultiProcessor - Maximum Shared Memory Per Multiprocessor.
func (d *DeviceProp) MaxSharedMemoryPerMultiProcessor() uint {
return (uint)(d.maxSharedMemoryPerMultiProcessor)
}
//TotalConstMem - Size of shared memory region (in bytes).
func (d *DeviceProp) TotalConstMem() uint {
return (uint)(d.totalConstMem)
}
//RegsPerBlock - Registers per block.
func (d *DeviceProp) RegsPerBlock() int32 {
return (int32)(d.regsPerBlock)
}
//WarpSize - Warp size.
func (d *DeviceProp) WarpSize() int32 {
return (int32)(d.warpSize)
}
//MaxThreadsPerBlock - Max work items per work group or workgroup max size.
func (d *DeviceProp) MaxThreadsPerBlock() int32 {
return (int32)(d.maxThreadsPerBlock)
}
//MaxThreadsDim - Max number of threads in each dimension (XYZ) of a block.
func (d *DeviceProp) MaxThreadsDim() []int32 {
x := make([]int32, 3)
for i := 0; i < 3; i++ {
x[0] = (int32)(d.maxThreadsDim[i])
}
return x
}
//MaxGridSize - Max grid dimensions (XYZ).
func (d *DeviceProp) MaxGridSize() []int32 {
x := make([]int32, 3)
for i := 0; i < 3; i++ {
x[0] = (int32)(d.maxGridSize[i])
}
return x
}
//ClockRate - Max clock frequency of the multiProcessors in khz.
func (d *DeviceProp) ClockRate() int32 {
return (int32)(d.clockRate)
}
//MemoryClockRate -Max global memory clock frequency in khz.
func (d *DeviceProp) MemoryClockRate() int32 {
return (int32)(d.memoryClockRate)
}
//MemoryBusWidth -G lobal memory bus width in bits.
func (d *DeviceProp) MemoryBusWidth() int32 {
return (int32)(d.memoryBusWidth)
}
//Major - Major compute capability. On HCC, this is an approximation and features may
//differ from CUDA CC. See the arch feature flags for portable ways to query
//feature caps.
func (d *DeviceProp) Major() int32 {
return (int32)(d.major)
}
//Minor - Minor compute capability. On HCC, this is an approximation and features may
//differ from CUDA CC. See the arch feature flags for portable ways to query
//feature caps.
func (d *DeviceProp) Minor() int32 {
return (int32)(d.minor)
}
//MultiProcessorCount - Number of multi-processors (compute units).
func (d *DeviceProp) MultiProcessorCount() int32 {
return (int32)(d.multiProcessorCount)
}
//L2CacheSize - L2 cache size.
func (d *DeviceProp) L2CacheSize() int32 {
return (int32)(d.l2CacheSize)
}
//MaxThreadsPerMultiProcessor - Maximum resident threads per multi-processor.
func (d *DeviceProp) MaxThreadsPerMultiProcessor() int32 {
return (int32)(d.maxThreadsPerMultiProcessor)
}
//ComputeMode - Compute mode.
func (d *DeviceProp) ComputeMode() int32 {
return (int32)(d.computeMode)
}
//ClockInstructionRate - Frequency in khz of the timer used by the device-side "clock*"
//instructions. New for HIP.
func (d *DeviceProp) ClockInstructionRate() int32 {
return (int32)(d.clockInstructionRate)
}
//ConcurrentKernels - Device can possibly execute multiple kernels concurrently.
func (d *DeviceProp) ConcurrentKernels() int32 {
return (int32)(d.concurrentKernels)
}
//PciDomainID - PCI Domain ID
func (d *DeviceProp) PciDomainID() int32 {
return (int32)(d.pciDomainID)
}
//PciBusID - PCI Bus ID.
func (d *DeviceProp) PciBusID() int32 {
return (int32)(d.pciBusID)
}
//PciDeviceID - PCI Device ID.
func (d *DeviceProp) PciDeviceID() int32 {
return (int32)(d.pciDeviceID)
}
//IsMultiGpuBoard - 1 if device is on a multi-GPU board, 0 if not.
func (d *DeviceProp) IsMultiGpuBoard() int32 {
return (int32)(d.isMultiGpuBoard)
}
//CanMapHostMemory - Check whether HIP can map host memory
func (d *DeviceProp) CanMapHostMemory() int32 {
return (int32)(d.canMapHostMemory)
}
//GcnArch - AMD GCN Arch Value. Eg: 803, 701
func (d *DeviceProp) GcnArch() int32 {
return (int32)(d.gcnArch)
}
//Integrated - APU vs dGPU
func (d *DeviceProp) Integrated() int32 {
return (int32)(d.integrated)
}
//CooperativeLaunch - HIP device supports cooperative launch
func (d *DeviceProp) CooperativeLaunch() int32 {
return (int32)(d.cooperativeLaunch)
}
//CooperativeMultiDeviceLaunch - HIP device supports cooperative launch on multiple devices
func (d *DeviceProp) CooperativeMultiDeviceLaunch() int32 {
return (int32)(d.cooperativeMultiDeviceLaunch)
}
//DeviceArch contains bit flags.
//
//TODO: Will have to write a tiny c function to access
type DeviceArch C.hipDeviceArch_t
/*
//GlobalInt32Atomics - 32-bit integer atomics for global memory.
func (d DeviceArch) GlobalInt32Atomics() bool { return false }
//GlobalFloatAtomicExch - 32-bit float atomic exch for global memory.
func (d DeviceArch) GlobalFloatAtomicExch() bool { return false }
//SharedInt32Atomics - 32-bit integer atomics for shared memory.
func (d DeviceArch) SharedInt32Atomics() bool { return false }
//SharedFloatAtomicExch - 32-bit float atomic exch for shared memory.
func (d DeviceArch) SharedFloatAtomicExch() bool { return false }
//FloatAtomicAdd - 32-bit float atomic add in global and shared memory.
func (d DeviceArch) FloatAtomicAdd() bool { return false }
//GlobalInt64Atomics - 64-bit integer atomics for global memory.
func (d DeviceArch) GlobalInt64Atomics() bool { return false }
//SharedInt64Atomics - 64-bit integer atomics for shared memory.
func (d DeviceArch) SharedInt64Atomics() bool { return false }
//Doubles - Double-precision floating point.
func (d DeviceArch) Doubles() bool { return false }
//WarpVote - Warp vote instructions (__any, __all).
func (d DeviceArch) WarpVote() bool { return false }
//WarpBallot - Warp ballot instructions (__ballot).
func (d DeviceArch) WarpBallot() bool { return false }
//WarpShuffle - Warp shuffle operations. (__shfl_*).
func (d DeviceArch) WarpShuffle() bool { return false }
//FunnelShift - Funnel two words into one with shift&mask caps.
func (d DeviceArch) FunnelShift() bool { return false }
//ThreadFenceSystem - __threadfence_system.
func (d DeviceArch) ThreadFenceSystem() bool { return false }
//SyncThreadsExt - __syncthreads_count, syncthreads_and, syncthreads_or.
func (d DeviceArch) SyncThreadsExt() bool { return false }
//SurfaceFuncs - Surface functions.
func (d DeviceArch) SurfaceFuncs() bool { return false }
//Grid3D - Grid and group dims are 3D (rather than 2D).
func (d DeviceArch) Grid3D() bool { return false }
//DynamicParallelism - Dynamic parallelism.
func (d DeviceArch) DynamicParallelism() bool { return false }
*/