Skip to content

Commit

Permalink
program: add an initial program implementation.
Browse files Browse the repository at this point in the history
In order to get the CTS common code to compile we need
the structure of a program object it can use.
  • Loading branch information
airlied committed Jun 28, 2018
1 parent 9aaa7d0 commit aa77730
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/CL/sycl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include "CL/sycl/pipe.hpp"
#include "CL/sycl/pipe_reservation.hpp"
#include "CL/sycl/platform.hpp"
#include "CL/sycl/program.hpp"
#include "CL/sycl/queue.hpp"
#include "CL/sycl/range.hpp"
#include "CL/sycl/static_pipe.hpp"
Expand Down
103 changes: 103 additions & 0 deletions include/CL/sycl/program.hpp
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
52 changes: 52 additions & 0 deletions include/CL/sycl/program/detail/program.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef TRISYCL_SYCL_PROGRAM_DETAIL_PROGRAM_HPP
#define TRISYCL_SYCL_PROGRAM_DETAIL_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/unimplemented.hpp"

namespace cl {
namespace sycl {
namespace detail {

class program : detail::debug<detail::program> {

public:

#ifdef TRISYCL_OPENCL
/** Return the OpenCL kernel object for this kernel
Retains a reference to the returned cl_kernel object. Caller
should release it when finished.
*/
virtual cl_program get() const = 0;
#endif

virtual ~program() {}
};

}
}
}

/*
# Some Emacs stuff:
### Local Variables:
### ispell-local-dictionary: "american"
### eval: (flyspell-prog-mode)
### End:
*/

#endif // TRISYCL_SYCL_DETAIL_PROGRAM_PROGRAM_HPP


0 comments on commit aa77730

Please sign in to comment.