Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
3121441d
Commit
3121441d
authored
Apr 10, 2018
by
Lianmin Zheng
Committed by
Tianqi Chen
Apr 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add device name to context attribute (#1090)
* add device name to context attribute * update for other backends
parent
ee514eac
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
2 deletions
+28
-2
include/tvm/runtime/device_api.h
+1
-0
python/tvm/_ffi/runtime_ctypes.py
+7
-1
src/runtime/cuda/cuda_device_api.cc
+7
-1
src/runtime/metal/metal_device_api.mm
+1
-0
src/runtime/opencl/opencl_device_api.cc
+8
-0
src/runtime/opengl/opengl_device_api.cc
+2
-0
src/runtime/rocm/rocm_device_api.cc
+1
-0
src/runtime/vulkan/vulkan_device_api.cc
+1
-0
No files found.
include/tvm/runtime/device_api.h
View file @
3121441d
...
...
@@ -21,6 +21,7 @@ enum DeviceAttrKind : int {
kWarpSize
=
2
,
kMaxSharedMemoryPerBlock
=
3
,
kComputeVersion
=
4
,
kDeviceName
=
5
};
/*! \brief Number of bytes each allocation must align to */
...
...
python/tvm/_ffi/runtime_ctypes.py
View file @
3121441d
...
...
@@ -142,7 +142,7 @@ class TVMContext(ctypes.Structure):
@property
def
max_shared_memory_per_block
(
self
):
"""Total amount of shared memory per block in bytes"""
"""Total amount of shared memory per block in bytes
.
"""
return
_api_internal
.
_GetDeviceAttr
(
self
.
device_type
,
self
.
device_id
,
3
)
...
...
@@ -160,6 +160,12 @@ class TVMContext(ctypes.Structure):
return
_api_internal
.
_GetDeviceAttr
(
self
.
device_type
,
self
.
device_id
,
4
)
@property
def
device_name
(
self
):
"""Return the string name of device."""
return
_api_internal
.
_GetDeviceAttr
(
self
.
device_type
,
self
.
device_id
,
5
)
def
sync
(
self
):
"""Synchronize until jobs finished at the context."""
check_call
(
_LIB
.
TVMSynchronize
(
self
.
device_type
,
self
.
device_id
,
None
))
...
...
src/runtime/cuda/cuda_device_api.cc
View file @
3121441d
...
...
@@ -30,7 +30,7 @@ class CUDADeviceAPI final : public DeviceAPI {
&
value
,
cudaDevAttrMaxThreadsPerBlock
,
ctx
.
device_id
)
==
cudaSuccess
);
break
;
case
kMaxThreadsPerBlock
:
{
case
kMaxThreadsPerBlock
:
{
CUDA_CALL
(
cudaDeviceGetAttribute
(
&
value
,
cudaDevAttrMaxThreadsPerBlock
,
ctx
.
device_id
));
break
;
...
...
@@ -56,6 +56,12 @@ class CUDADeviceAPI final : public DeviceAPI {
*
rv
=
os
.
str
();
return
;
}
case
kDeviceName
:
{
cudaDeviceProp
props
;
CUDA_CALL
(
cudaGetDeviceProperties
(
&
props
,
ctx
.
device_id
));
*
rv
=
std
::
string
(
props
.
name
);
return
;
}
}
*
rv
=
value
;
}
...
...
src/runtime/metal/metal_device_api.mm
View file @
3121441d
...
...
@@ -41,6 +41,7 @@ void MetalWorkspace::GetAttr(
}
case kMaxSharedMemoryPerBlock: return;
case kComputeVersion: return;
case kDeviceName: return;
case kExist: break;
}
}
...
...
src/runtime/opencl/opencl_device_api.cc
View file @
3121441d
...
...
@@ -54,6 +54,14 @@ void OpenCLWorkspace::GetAttr(
break
;
}
case
kComputeVersion
:
return
;
case
kDeviceName
:
{
char
value
[
128
]
=
{
0
};
OPENCL_CALL
(
clGetDeviceInfo
(
devices
[
index
],
CL_DEVICE_NAME
,
sizeof
(
value
)
-
1
,
value
,
nullptr
));
*
rv
=
std
::
string
(
value
);
break
;
}
case
kExist
:
break
;
}
}
...
...
src/runtime/opengl/opengl_device_api.cc
View file @
3121441d
...
...
@@ -93,9 +93,11 @@ void OpenGLWorkspace::GetAttr(
*
rv
=
1
;
break
;
}
case
kMaxSharedMemoryPerBlock
:
return
;
case
kComputeVersion
:
{
break
;
}
case
kDeviceName
:
return
;
}
}
...
...
src/runtime/rocm/rocm_device_api.cc
View file @
3121441d
...
...
@@ -51,6 +51,7 @@ class ROCMDeviceAPI final : public DeviceAPI {
*
rv
=
prop
.
gcnArch
;
return
;
}
case
kDeviceName
:
return
;
}
*
rv
=
value
;
}
...
...
src/runtime/vulkan/vulkan_device_api.cc
View file @
3121441d
...
...
@@ -73,6 +73,7 @@ void VulkanWorkspace::GetAttr(
*
rv
=
os
.
str
();
break
;
}
case
kDeviceName
:
return
;
case
kExist
:
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment