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
68e4a111
Commit
68e4a111
authored
Jul 09, 2018
by
alex-weaver
Committed by
Tianqi Chen
Jul 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TVM] Fixed SPIR-V codegen incorrectly not declaring the interface for the entry point (#1400)
parent
5cf4d94a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
src/codegen/spirv/codegen_spirv.cc
+3
-1
src/codegen/spirv/ir_builder.cc
+14
-5
src/codegen/spirv/ir_builder.h
+10
-3
No files found.
src/codegen/spirv/codegen_spirv.cc
View file @
68e4a111
...
@@ -35,7 +35,7 @@ std::vector<uint32_t> CodeGenSPIRV::BuildFunction(const LoweredFunc& f) {
...
@@ -35,7 +35,7 @@ std::vector<uint32_t> CodeGenSPIRV::BuildFunction(const LoweredFunc& f) {
pod_args
.
push_back
(
arg
);
pod_args
.
push_back
(
arg
);
}
}
}
}
spirv
::
Value
func_ptr
=
builder_
->
DeclareKenrelFunction
(
f
->
name
);
spirv
::
Value
func_ptr
=
builder_
->
NewFunction
(
);
builder_
->
StartFunction
(
func_ptr
);
builder_
->
StartFunction
(
func_ptr
);
// All the POD arguments are passed in through PushConstant
// All the POD arguments are passed in through PushConstant
...
@@ -56,6 +56,8 @@ std::vector<uint32_t> CodeGenSPIRV::BuildFunction(const LoweredFunc& f) {
...
@@ -56,6 +56,8 @@ std::vector<uint32_t> CodeGenSPIRV::BuildFunction(const LoweredFunc& f) {
builder_
->
MakeInst
(
spv
::
OpReturn
);
builder_
->
MakeInst
(
spv
::
OpReturn
);
builder_
->
MakeInst
(
spv
::
OpFunctionEnd
);
builder_
->
MakeInst
(
spv
::
OpFunctionEnd
);
builder_
->
CommitKernelFunction
(
func_ptr
,
f
->
name
);
return
builder_
->
Finalize
();
return
builder_
->
Finalize
();
}
}
...
...
src/codegen/spirv/ir_builder.cc
View file @
68e4a111
...
@@ -222,12 +222,21 @@ Value IRBuilder::GetPushConstant(
...
@@ -222,12 +222,21 @@ Value IRBuilder::GetPushConstant(
return
this
->
MakeValue
(
spv
::
OpLoad
,
v_type
,
ptr
);
return
this
->
MakeValue
(
spv
::
OpLoad
,
v_type
,
ptr
);
}
}
Value
IRBuilder
::
DeclareKenrelFunction
(
const
std
::
string
&
name
)
{
Value
IRBuilder
::
NewFunction
()
{
Value
val
=
NewValue
(
t_void_func_
,
kFunction
);
return
NewValue
(
t_void_func_
,
kFunction
);
}
void
IRBuilder
::
CommitKernelFunction
(
const
Value
&
func
,
const
std
::
string
&
name
)
{
CHECK_EQ
(
func
.
flag
,
kFunction
);
ib_
.
Begin
(
spv
::
OpEntryPoint
)
ib_
.
Begin
(
spv
::
OpEntryPoint
)
.
AddSeq
(
spv
::
ExecutionModelGLCompute
,
val
,
name
)
.
AddSeq
(
spv
::
ExecutionModelGLCompute
,
func
,
name
);
.
Commit
(
&
entry_
);
if
(
workgroup_id_
.
id
!=
0
)
{
return
val
;
ib_
.
Add
(
workgroup_id_
);
}
if
(
local_id_
.
id
!=
0
)
{
ib_
.
Add
(
local_id_
);
}
ib_
.
Commit
(
&
entry_
);
}
}
void
IRBuilder
::
StartFunction
(
const
Value
&
func
)
{
void
IRBuilder
::
StartFunction
(
const
Value
&
func
)
{
...
...
src/codegen/spirv/ir_builder.h
View file @
68e4a111
...
@@ -485,11 +485,18 @@ class IRBuilder {
...
@@ -485,11 +485,18 @@ class IRBuilder {
*/
*/
Value
GetPushConstant
(
Value
ptr_push_const
,
const
SType
&
v_type
,
uint32_t
index
);
Value
GetPushConstant
(
Value
ptr_push_const
,
const
SType
&
v_type
,
uint32_t
index
);
/*!
/*!
* \brief Declare a kernel function
* \brief Declare a new function
* \param name Name of the entry point.
* \return The created function ID.
* \return The created function ID.
*/
*/
Value
DeclareKenrelFunction
(
const
std
::
string
&
name
);
Value
NewFunction
();
/*!
* \brief Declare the entry point for a kernel function. This should be
* invoked after building the function so the builder is aware of which
* variables to declare as part of the function's interface.
* \param func The previously declared function.
* \param name Name of the entry point.
*/
void
CommitKernelFunction
(
const
Value
&
func
,
const
std
::
string
&
name
);
/*!
/*!
* \brief Start function scope.
* \brief Start function scope.
* \param func function to be started.
* \param func function to be started.
...
...
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