-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SYCL] Fix edge_detection and add it to the lit test-suite #87
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,6 @@ | |
#include "CL/sycl/xilinx/fpga/ssdm_inst.hpp" | ||
#include "CL/sycl/detail/defines.hpp" | ||
|
||
#if defined(__SYCL_DEVICE_ONLY__) | ||
#define SYCL_DEVICE_ANNOTATE(...) __attribute__((annotate(__VA_ARGS__))) | ||
#else | ||
#define SYCL_DEVICE_ANNOTATE(...) | ||
#endif | ||
|
||
__SYCL_INLINE_NAMESPACE(cl) { | ||
|
||
namespace sycl::xilinx { | ||
|
@@ -59,7 +53,7 @@ void dataflow(T functor) { | |
pipeline way. | ||
*/ | ||
template <typename T> | ||
SYCL_DEVICE_ANNOTATE("xilinx_pipeline") __attribute__((always_inline)) | ||
__SYCL_DEVICE_ANNOTATE("xilinx_pipeline") __attribute__((always_inline)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could even be |
||
void pipeline(T functor) { | ||
functor(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,8 @@ | |
# test_source_root: The root path where tests are located. | ||
config.test_source_root = os.path.dirname(__file__) | ||
|
||
timeout=600 | ||
|
||
# test_exec_root: The root path where tests should be run. | ||
config.test_exec_root = os.path.join(config.sycl_obj_root, 'test') | ||
|
||
|
@@ -80,7 +82,6 @@ | |
config.substitutions.append( ('%sycl_be', backend) ) | ||
|
||
xocc=lit_config.params.get('XOCC', "off") | ||
lit_config.note("XOCC={}".format(xocc)) | ||
|
||
get_device_count_by_type_path = os.path.join(config.llvm_tools_dir, "get_device_count_by_type") | ||
|
||
|
@@ -248,6 +249,13 @@ def getDeviceCount(device_type): | |
required_env = ['HOME', 'USER', 'XILINX_XRT', 'XILINX_SDX', 'XILINX_PLATFORM', 'EMCONFIG_PATH', 'LIBRARY_PATH'] | ||
has_error=False | ||
config.available_features.add("xocc") | ||
config.available_features.add(xocc_target) | ||
pkg_opencv4 = subprocess.run(["pkg-config", "--libs", "--cflags", "opencv4"], stdout=subprocess.PIPE) | ||
has_opencv4 = not pkg_opencv4.returncode | ||
lit_config.note("has opencv4: {}".format(has_opencv4)) | ||
if has_opencv4: | ||
config.available_features.add("opencv4") | ||
config.substitutions.append( ('%opencv4_flags', pkg_opencv4.stdout.decode('utf-8')[:-1]) ) | ||
for env in required_env: | ||
if env not in os.environ: | ||
lit_config.note("missing environnement variable: {}".format(env)) | ||
|
@@ -258,13 +266,25 @@ def getDeviceCount(device_type): | |
if xocc == "only": | ||
config.name = 'SYCL-XOCC' | ||
config.test_source_root = config.test_source_root + "/xocc_tests" | ||
run_if_hw="echo" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At least add some motivating comments |
||
run_if_hw_emu="echo" | ||
run_if_sw_emu="echo" | ||
if xocc_target == "hw": | ||
timeout = 10800 # 3h | ||
run_if_hw="" | ||
if xocc_target == "hw_emu": | ||
timeout = 1800 # 30min | ||
run_if_hw_emu="" | ||
if xocc_target == "sw_emu": | ||
run_if_sw_emu="" | ||
config.substitutions.append( ('%run_if_hw', run_if_hw) ) | ||
config.substitutions.append( ('%run_if_hw_emu', run_if_hw_emu) ) | ||
config.substitutions.append( ('%run_if_sw_emu', run_if_sw_emu) ) | ||
|
||
|
||
# Set timeout for test = 10 mins | ||
try: | ||
import psutil | ||
lit_config.maxIndividualTestTime = 600 | ||
if "XCL_EMULATION_MODE" in os.environ: | ||
if os.environ["XCL_EMULATION_MODE"] == "hw": | ||
lit_config.maxIndividualTestTime = 10800 # 3h | ||
lit_config.maxIndividualTestTime = timeout | ||
except ImportError: | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
// RUN: true | ||
// REQUIRES: xocc && opencv4 | ||
|
||
// RUN: %clangxx -std=c++20 -fsycl -fsycl-targets=%sycl_triple -o %t.out %s %opencv4_flags | ||
// RUN: %run_if_hw %ACC_RUN_PLACEHOLDER %t.out %S/data/input/eiffel.bmp | ||
// RUN: %run_if_hw %ACC_RUN_PLACEHOLDER %t.out %S/data/input/lola.bmp | ||
// RUN: %run_if_hw %ACC_RUN_PLACEHOLDER %t.out %S/data/input/vase.bmp | ||
// RUN: %run_if_sw_emu %ACC_RUN_PLACEHOLDER %t.out %S/data/input/eiffel.bmp | ||
// RUN: %run_if_sw_emu %ACC_RUN_PLACEHOLDER %t.out %S/data/input/lola.bmp | ||
// RUN: %run_if_sw_emu %ACC_RUN_PLACEHOLDER %t.out %S/data/input/vase.bmp | ||
|
||
/* | ||
Attempt at translating SDAccel Examples edge_detection example to SYCL | ||
|
@@ -29,7 +37,7 @@ | |
#include <opencv2/imgproc/imgproc.hpp> | ||
#include <opencv2/highgui/highgui.hpp> | ||
|
||
#include "../../utilities/device_selectors.hpp" | ||
#include "../utilities/device_selectors.hpp" | ||
|
||
using namespace cl::sycl; | ||
|
||
|
@@ -50,9 +58,9 @@ int main(int argc, char* argv[]) { | |
// using fixed constexpr values stays more true to the original implementation | ||
// however you can in theory just use input.rows/cols to support a wider range | ||
// of image sizes. | ||
constexpr auto height = 1895; // input.rows; | ||
constexpr auto width = 1024; // input.cols; | ||
constexpr auto area = height * width; | ||
const size_t height = input.rows; | ||
const size_t width = input.cols; | ||
const size_t area = height * width; | ||
|
||
selector_defines::CompiledForDeviceSelector selector; | ||
queue q {selector, property::queue::enable_profiling()}; | ||
|
@@ -71,6 +79,7 @@ int main(int argc, char* argv[]) { | |
std::cout << "Max Energy = " << ceil(log2((long long)iMax * 2 * 3 * 3)) + 1 | ||
<< " Bits \n"; | ||
std::cout << "Image Dimensions: " << input.size() << "\n"; | ||
std::cout << "Used Size: " << height << "x" << width << " = " << area << "\n"; | ||
|
||
// mapping the enqueueTask call to a single_task, interested in seeing if a | ||
// parallel_for without a fixed 1-1-1 mapping is workable on an FPGA though.. | ||
|
@@ -92,10 +101,10 @@ int main(int argc, char* argv[]) { | |
// to parallel_fors with local sizes | ||
[=]() { | ||
auto gX = xilinx::partition_array<char, 9, | ||
xilinx::partition::complete<0>>({-1, 0, 1, -2, 0, 2, -1, 0, 1}); | ||
xilinx::partition::complete<1>>({-1, 0, 1, -2, 0, 2, -1, 0, 1}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious this change. |
||
|
||
auto gY = xilinx::partition_array<char, 9, | ||
xilinx::partition::complete<0>>({1, 2, 1, 0, 0, 0, -1, -2, -1}); | ||
xilinx::partition::complete<1>>({1, 2, 1, 0, 0, 0, -1, -2, -1}); | ||
|
||
int magX, magY, gI, pIndex; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you are removing the support for the old style SSDM?
I guess it is no longer used anyway @yu810226 @aisoard
By the way, I am expecting the same level of comments elsewhere in the code... :-)