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
12cf7754
Commit
12cf7754
authored
Jul 18, 2018
by
MORITA Kazutaka
Committed by
Tianqi Chen
Jul 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RUNTIME][OPENCL] show correct device type name (#1441)
parent
fe0f99b2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
15 deletions
+11
-15
src/runtime/opencl/opencl_common.h
+6
-3
src/runtime/opencl/opencl_device_api.cc
+4
-2
src/runtime/opencl/opencl_module.cc
+0
-4
src/runtime/opencl/sdaccel/sdaccel_device_api.cc
+1
-1
src/runtime/opencl/sdaccel/sdaccel_module.cc
+0
-5
No files found.
src/runtime/opencl/opencl_common.h
View file @
12cf7754
...
...
@@ -108,6 +108,8 @@ class OpenCLThreadEntry;
*/
class
OpenCLWorkspace
:
public
DeviceAPI
{
public
:
// type key
std
::
string
type_key
;
// global platform id
cl_platform_id
platform_id
;
// global platform name
...
...
@@ -138,9 +140,10 @@ class OpenCLWorkspace : public DeviceAPI {
}
}
// Initialzie the device.
void
Init
(
const
std
::
string
&
device_type
,
const
std
::
string
&
platform_name
=
""
);
void
Init
(
const
std
::
string
&
type_key
,
const
std
::
string
&
device_type
,
const
std
::
string
&
platform_name
=
""
);
virtual
void
Init
()
{
Init
(
"gpu"
);
Init
(
"
opencl"
,
"
gpu"
);
}
// Check whether the context is OpenCL or not.
virtual
bool
IsOpenCLDevice
(
TVMContext
ctx
)
{
...
...
@@ -240,7 +243,7 @@ class OpenCLModuleNode : public ModuleNode {
*/
virtual
const
std
::
shared_ptr
<
cl
::
OpenCLWorkspace
>&
GetGlobalWorkspace
();
virtual
const
char
*
type_key
()
const
;
const
char
*
type_key
()
const
final
{
return
workspace_
->
type_key
.
c_str
();
}
PackedFunc
GetFunction
(
const
std
::
string
&
name
,
...
...
src/runtime/opencl/opencl_device_api.cc
View file @
12cf7754
...
...
@@ -227,7 +227,8 @@ bool MatchPlatformInfo(
return
param_value
.
find
(
value
)
!=
std
::
string
::
npos
;
}
void
OpenCLWorkspace
::
Init
(
const
std
::
string
&
device_type
,
const
std
::
string
&
platform_name
)
{
void
OpenCLWorkspace
::
Init
(
const
std
::
string
&
type_key
,
const
std
::
string
&
device_type
,
const
std
::
string
&
platform_name
)
{
if
(
initialized_
)
return
;
std
::
lock_guard
<
std
::
mutex
>
lock
(
this
->
mu
);
if
(
initialized_
)
return
;
...
...
@@ -246,6 +247,7 @@ void OpenCLWorkspace::Init(const std::string& device_type, const std::string& pl
}
std
::
vector
<
cl_device_id
>
devices_matched
=
cl
::
GetDeviceIDs
(
platform_id
,
device_type
);
if
(
devices_matched
.
size
()
>
0
)
{
this
->
type_key
=
type_key
;
this
->
platform_id
=
platform_id
;
this
->
platform_name
=
cl
::
GetPlatformInfo
(
platform_id
,
CL_PLATFORM_NAME
);
this
->
device_type
=
device_type
;
...
...
@@ -271,7 +273,7 @@ void OpenCLWorkspace::Init(const std::string& device_type, const std::string& pl
this
->
queues
.
push_back
(
clCreateCommandQueue
(
this
->
context
,
did
,
0
,
&
err_code
));
OPENCL_CHECK_ERROR
(
err_code
);
LOG
(
INFO
)
<<
"opencl
("
<<
i
LOG
(
INFO
)
<<
type_key
<<
"
("
<<
i
<<
")=
\'
"
<<
cl
::
GetDeviceInfo
(
did
,
CL_DEVICE_NAME
)
<<
"
\'
cl_device_id="
<<
did
;
}
...
...
src/runtime/opencl/opencl_module.cc
View file @
12cf7754
...
...
@@ -100,10 +100,6 @@ const std::shared_ptr<cl::OpenCLWorkspace>& OpenCLModuleNode::GetGlobalWorkspace
return
cl
::
OpenCLWorkspace
::
Global
();
}
const
char
*
OpenCLModuleNode
::
type_key
()
const
{
return
"opencl"
;
}
PackedFunc
OpenCLModuleNode
::
GetFunction
(
const
std
::
string
&
name
,
const
std
::
shared_ptr
<
ModuleNode
>&
sptr_to_self
)
{
...
...
src/runtime/opencl/sdaccel/sdaccel_device_api.cc
View file @
12cf7754
...
...
@@ -20,7 +20,7 @@ const std::shared_ptr<OpenCLWorkspace>& SDAccelWorkspace::Global() {
}
void
SDAccelWorkspace
::
Init
()
{
OpenCLWorkspace
::
Init
(
"accelerator"
,
"Xilinx"
);
OpenCLWorkspace
::
Init
(
"
sdaccel"
,
"
accelerator"
,
"Xilinx"
);
}
bool
SDAccelWorkspace
::
IsOpenCLDevice
(
TVMContext
ctx
)
{
...
...
src/runtime/opencl/sdaccel/sdaccel_module.cc
View file @
12cf7754
...
...
@@ -21,17 +21,12 @@ class SDAccelModuleNode : public OpenCLModuleNode {
std
::
string
source
)
:
OpenCLModuleNode
(
data
,
fmt
,
fmap
,
source
)
{}
const
std
::
shared_ptr
<
cl
::
OpenCLWorkspace
>&
GetGlobalWorkspace
()
final
;
const
char
*
type_key
()
const
final
;
};
const
std
::
shared_ptr
<
cl
::
OpenCLWorkspace
>&
SDAccelModuleNode
::
GetGlobalWorkspace
()
{
return
cl
::
SDAccelWorkspace
::
Global
();
}
const
char
*
SDAccelModuleNode
::
type_key
()
const
{
return
"sdaccel"
;
}
Module
SDAccelModuleCreate
(
std
::
string
data
,
std
::
string
fmt
,
...
...
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