forked from triSYCL/triSYCL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request triSYCL#151 from airlied/cts-select_device
Implement select device This series allows triSYCL to build the cts test_device_selector and execute it. It unfortunately has to add a dummy `half` implementation and some basic bits of the program object, in order just to get the CTS common code to compile. Otherwise it fixes up the platform and device_selector code.
- Loading branch information
Showing
13 changed files
with
261 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef TRISYCL_SYCL_HALF_HPP | ||
#define TRISYCL_SYCL_HALF_HPP | ||
|
||
/** \file SYCL Half support - dummy | ||
This file is distributed under the University of Illinois Open Source | ||
License. See LICENSE.TXT for details. | ||
*/ | ||
|
||
/* Dummy half implementation - this is enough to get the CTS to build. */ | ||
namespace cl { | ||
namespace sycl { | ||
|
||
class half { | ||
public: | ||
half(int) {}; | ||
|
||
bool operator>(const half &h1) { return false; }; | ||
}; | ||
|
||
} | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef TRISYCL_SYCL_PLATFORM_TAIL_HPP | ||
#define TRISYCL_SYCL_PLATFORM_TAIL_HPP | ||
|
||
/** \file The ending part of the OpenCL SYCL platform | ||
This is here to break a dependence between platform and device_selector. | ||
This file is distributed under the University of Illinois Open Source | ||
License. See LICENSE.TXT for details. | ||
*/ | ||
|
||
namespace cl { | ||
namespace sycl { | ||
|
||
inline | ||
platform::platform(const device_selector &device_selector) { | ||
platform host_platform = {}; | ||
#ifdef TRISYCL_OPENCL | ||
if (host_platform.implementation->get_devices(device_selector).empty()) { | ||
for (const auto &d : boost::compute::system::platforms()) { | ||
auto clplatform = cl::sycl::platform { d }; | ||
auto devices = clplatform.implementation->get_devices(device_selector); | ||
if (!devices.empty()) { | ||
*this = std::move(clplatform); | ||
return; | ||
} | ||
} | ||
} | ||
#endif | ||
*this = std::move(host_platform); | ||
} | ||
|
||
inline vector_class<device> | ||
platform::get_devices(info::device_type device_type) const { | ||
return implementation->get_devices(device_type_selector { device_type }); | ||
} | ||
|
||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
#ifndef TRISYCL_SYCL_PROGRAM_HPP | ||
#define TRISYCL_SYCL_PROGRAM_HPP | ||
|
||
/** \file The OpenCL SYCL program | ||
Dave Airlie | ||
This file is distributed under the University of Illinois Open Source | ||
License. See LICENSE.TXT for details. | ||
*/ | ||
|
||
#ifdef TRISYCL_OPENCL | ||
#include <boost/compute.hpp> | ||
#endif | ||
|
||
#include "CL/sycl/detail/debug.hpp" | ||
#include "CL/sycl/detail/shared_ptr_implementation.hpp" | ||
#include "CL/sycl/detail/unimplemented.hpp" | ||
#include "CL/sycl/kernel.hpp" | ||
#include "CL/sycl/program/detail/program.hpp" | ||
|
||
namespace cl { | ||
namespace sycl { | ||
|
||
enum class program_state { | ||
none, | ||
compiled, | ||
linked | ||
}; | ||
|
||
/** SYCL program | ||
\todo To be implemented | ||
*/ | ||
|
||
class program | ||
/* Use the underlying kernel implementation that can be shared in | ||
the SYCL model */ | ||
: public detail::shared_ptr_implementation<program, detail::program> { | ||
|
||
// The type encapsulating the implementation | ||
using implementation_t = typename program::shared_ptr_implementation; | ||
|
||
// The handler class uses the implementation | ||
friend class handler; | ||
|
||
// Allows the comparison operation to access the implementation | ||
friend implementation_t; | ||
|
||
public: | ||
|
||
// Make the implementation member directly accessible in this class | ||
using implementation_t::implementation; | ||
|
||
program() = delete; | ||
|
||
#ifdef TRISYCL_OPENCL | ||
|
||
program(const context &context, cl_program p) {} | ||
|
||
cl_program get() const { | ||
return implementation->get(); | ||
} | ||
|
||
template <typename kernelT> | ||
bool has_kernel() const; | ||
|
||
bool has_kernel(string_class kernelName) const; | ||
|
||
template <typename kernelT> | ||
void compile_with_kernel_type(string_class compileOptions = "") | ||
{ | ||
|
||
} | ||
|
||
template <typename kernelT> | ||
void build_with_kernel_type(string_class buildOptions = "") | ||
{ | ||
} | ||
|
||
template <typename kernelT> | ||
cl::sycl::kernel get_kernel() const; | ||
|
||
kernel get_kernel(string_class kernelName) const { | ||
return NULL; | ||
} | ||
#endif | ||
}; | ||
|
||
} | ||
|
||
} | ||
|
||
/* | ||
# Some Emacs stuff: | ||
### Local Variables: | ||
### ispell-local-dictionary: "american" | ||
### eval: (flyspell-prog-mode) | ||
### End: | ||
*/ | ||
|
||
#endif |
Oops, something went wrong.