|
Graph Framework
|
Class representing a cpu context. More...
#include <cpu_context.hpp>
Public Member Functions | |
| cpu_context (const size_t index) | |
| Construct a cpu context. | |
| void | compile (const std::string kernel_source, std::vector< std::string > names, const bool add_reduction=false) |
| Compile the kernels. | |
| std::function< void(void)> | create_kernel_call (const std::string kernel_name, graph::input_nodes< T, SAFE_MATH > inputs, graph::output_nodes< T, SAFE_MATH > outputs, graph::shared_random_state< T, SAFE_MATH > state, const size_t num_rays, const jit::texture1d_list &tex1d_list, const jit::texture2d_list &tex2d_list) |
| Create a kernel calling function. | |
| std::function< T(void)> | create_max_call (graph::shared_leaf< T, SAFE_MATH > &argument, std::function< void(void)> run) |
| Create a max compute pipeline. | |
| void | wait () |
| Hold the current thread until the command buffer has completed. | |
| void | print_results (const size_t index, const graph::output_nodes< T, SAFE_MATH > &nodes) |
| Print out the results. | |
| T | check_value (const size_t index, const graph::shared_leaf< T, SAFE_MATH > &node) |
| Check the value. | |
| void | copy_to_device (graph::shared_leaf< T, SAFE_MATH > node, T *source) |
| Copy buffer contents to the device. | |
| void | copy_to_host (const graph::shared_leaf< T, SAFE_MATH > node, T *destination) |
| Copy buffer contents to host. | |
| void | create_header (std::ostringstream &source_buffer) |
| Create the source header. | |
| void | create_kernel_prefix (std::ostringstream &source_buffer, const std::string name, graph::input_nodes< T, SAFE_MATH > &inputs, graph::output_nodes< T, SAFE_MATH > &outputs, graph::shared_random_state< T, SAFE_MATH > state, const size_t size, const std::vector< bool > &is_constant, jit::register_map ®isters, const jit::register_usage &usage, jit::texture1d_list &textures1d, jit::texture2d_list &textures2d) |
| Create kernel prefix. | |
| void | create_kernel_postfix (std::ostringstream &source_buffer, graph::output_nodes< T, SAFE_MATH > &outputs, graph::map_nodes< T, SAFE_MATH > &setters, graph::shared_random_state< T, SAFE_MATH > state, jit::register_map ®isters, jit::register_map &indices, const jit::register_usage &usage) |
| Create kernel postfix. | |
| void | create_reduction (std::ostringstream &source_buffer, const size_t size) |
| Create a reduction kernel. | |
| T * | get_buffer (graph::shared_leaf< T, SAFE_MATH > &node) |
| Get the buffer for a node. | |
Static Public Member Functions | |
| static size_t | max_concurrency () |
| Get the maximum number of concurrent instances. | |
| static std::string | device_type () |
| Device discription. | |
Public Attributes | |
| int | remaining_const_memory |
| Remaining constant memory in bytes. NOT USED. | |
Static Public Attributes | |
| static constexpr size_t | random_state_size = 1 |
| Size of random state needed. | |
Class representing a cpu context.
| T | Base type of the calculation. |
| SAFE_MATH | Use Safe Math operations. |
|
inline |
Construct a cpu context.
| [in] | index | Concurrent index. Not used. |
|
inline |
Check the value.
| [in] | index | Ray index to check value for. |
| [in] | node | Node to check the value for. |
|
inline |
Compile the kernels.
| [in] | kernel_source | Source code buffer for the kernel. |
| [in] | names | Names of the kernel functions. |
| [in] | add_reduction | Include the reduction kernel. |
|
inline |
Copy buffer contents to the device.
| [in] | node | Not to copy buffer to. |
| [in] | source | Host side buffer to copy from. |
|
inline |
Copy buffer contents to host.
| [in] | node | Node to copy buffer from. |
| [in,out] | destination | Host side buffer to copy to. |
|
inline |
Create the source header.
| [in,out] | source_buffer | Source buffer stream. |
|
inline |
Create a kernel calling function.
| [in] | kernel_name | Name of the kernel for later reference. |
| [in] | inputs | Input nodes of the kernel. |
| [in] | outputs | Output nodes of the kernel. |
| [in] | state | Random states. |
| [in] | num_rays | Number of rays to trace. |
| [in] | tex1d_list | List of 1D textures. |
| [in] | tex2d_list | List of 1D textures. |
|
inline |
Create kernel postfix.
| [in,out] | source_buffer | Source buffer stream. |
| [in] | outputs | Output nodes of the graph to compute. |
| [in] | setters | Map outputs back to input values. |
| [in] | state | Random states. |
| [in,out] | registers | Map of used registers. |
| [in,out] | indices | Map of used indices. |
| [in] | usage | List of register usage count. |
|
inline |
Create kernel prefix.
| [in,out] | source_buffer | Source buffer stream. |
| [in] | name | Name to call the kernel. |
| [in] | inputs | Input variables of the kernel. |
| [in] | outputs | Output nodes of the graph to compute. |
| [in] | state | Random states. |
| [in] | size | Size of the input buffer. |
| [in] | is_constant | Flags if the input is read only. |
| [in,out] | registers | Map of used registers. |
| [in] | usage | List of register usage count. |
| [in] | textures1d | List of 1D kernel textures. |
| [in] | textures2d | List of 2D kernel textures. |
|
inline |
Create a max compute pipeline.
| [in] | argument | Node to reduce. |
| [in] | run | Function to run before reduction. |
|
inline |
Create a reduction kernel.
| [in,out] | source_buffer | Source buffer stream. |
| [in] | size | Size of the input buffer. |
|
inline |
Get the buffer for a node.
GPU contexts have the concept of a host side and device side buffer which the CPU doesn't. Create a second map of host buffers and reference the memory pointer from that. This allows one thread to run the kernel while a different thread can use the results.
| [in] | node | Node to get the buffer for. |
|
inlinestatic |
Get the maximum number of concurrent instances.
|
inline |
Print out the results.
| [in] | index | Particle index to print. |
| [in] | nodes | Nodes to output. |
|
inline |
Hold the current thread until the command buffer has completed.
This syncs the host buffers with the kernel arguments so a kernel can run while another thread reads the results.