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
00c87b37
Commit
00c87b37
authored
Jul 19, 2018
by
MORITA Kazutaka
Committed by
Tianqi Chen
Jul 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CODEGEN][SDACCEL] add support for specifying FPGA device name (#1448)
parent
4e29ec33
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
python/tvm/contrib/sdaccel.py
+7
-2
src/codegen/codegen_vhls.cc
+5
-3
tests/python/integration/test_ewise_fpga.py
+2
-0
No files found.
python/tvm/contrib/sdaccel.py
View file @
00c87b37
...
...
@@ -6,7 +6,7 @@ from ..api import register_func
@register_func
(
"tvm_callback_sdaccel_compile"
)
def
compile_vhls
(
kernel_info
):
def
compile_vhls
(
kernel_info
,
device_name
):
"""Compile Vivado HLS code for SDAccel.
Parameters
...
...
@@ -15,6 +15,9 @@ def compile_vhls(kernel_info):
List of kernel information. The kernel information is a tuple of
function name and source code.
device_name : str
The name of the target device
Return
------
xclbin : bytearray
...
...
@@ -28,7 +31,9 @@ def compile_vhls(kernel_info):
"sw_emu"
if
os
.
environ
.
get
(
"XCL_EMULATION_MODE"
)
else
"hw"
)
advanced_params
=
[
"--xp"
,
"param:compiler.preserveHlsOutput=1"
,
"--xp"
,
"param:compiler.generateExtraRunData=true"
]
platform
=
os
.
environ
.
get
(
"XCL_PLATFORM"
,
os
.
environ
.
get
(
"AWS_PLATFORM"
))
platform
=
device_name
if
not
platform
:
platform
=
os
.
environ
.
get
(
"XCL_PLATFORM"
,
os
.
environ
.
get
(
"AWS_PLATFORM"
))
if
platform
is
None
:
raise
RuntimeError
(
"No Xlinx device specified."
)
...
...
src/codegen/codegen_vhls.cc
View file @
00c87b37
...
...
@@ -2,6 +2,7 @@
* Copyright (c) 2018 by Contributors
* \file codegen_vhls.cc
*/
#include <tvm/build_module.h>
#include <vector>
#include <string>
#include "./codegen_vhls.h"
...
...
@@ -67,7 +68,7 @@ void CodeGenVivadoHLS::PreFunctionBody(LoweredFunc f) {
}
runtime
::
Module
BuildSDAccel
(
Array
<
LoweredFunc
>
funcs
)
{
runtime
::
Module
BuildSDAccel
(
Array
<
LoweredFunc
>
funcs
,
std
::
string
target_str
)
{
using
tvm
::
runtime
::
Registry
;
bool
output_ssa
=
false
;
CodeGenVivadoHLS
cg
;
...
...
@@ -94,7 +95,8 @@ runtime::Module BuildSDAccel(Array<LoweredFunc> funcs) {
std
::
string
xclbin
;
if
(
const
auto
*
f
=
Registry
::
Get
(
"tvm_callback_sdaccel_compile"
))
{
xclbin
=
(
*
f
)(
kernel_info
).
operator
std
::
string
();
Target
target
=
Target
::
create
(
target_str
);
xclbin
=
(
*
f
)(
kernel_info
,
target
->
device_name
).
operator
std
::
string
();
}
else
{
LOG
(
FATAL
)
<<
"Cannot compile Vivado HLS code."
;
}
...
...
@@ -103,7 +105,7 @@ runtime::Module BuildSDAccel(Array<LoweredFunc> funcs) {
TVM_REGISTER_API
(
"codegen.build_sdaccel"
)
.
set_body
([](
TVMArgs
args
,
TVMRetValue
*
rv
)
{
*
rv
=
BuildSDAccel
(
args
[
0
]);
*
rv
=
BuildSDAccel
(
args
[
0
]
,
args
[
1
]
);
});
}
// namespace codegen
...
...
tests/python/integration/test_ewise_fpga.py
View file @
00c87b37
...
...
@@ -40,6 +40,8 @@ def test_exp():
b
.
asnumpy
(),
np
.
exp
(
a
.
asnumpy
()),
rtol
=
1e-5
)
check_device
(
"sdaccel"
)
if
"AWS_PLATFORM"
in
os
.
environ
:
check_device
(
"sdaccel -device="
+
os
.
environ
.
get
(
"AWS_PLATFORM"
))
def
test_multi_kernel
():
...
...
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