11#include <unordered_map>
12#include <unordered_set>
20#include <unordered_set>
26 std::same_as<T, std::complex<double>>;
39 std::same_as<T, std::complex<float>>;
44 std::same_as<T, std::complex<double>>;
47 static bool verbose = USE_VERBOSE;
56 template<
float_scalar T>
81 template<
float_scalar T>
95 template<
float_scalar T>
97 return use_cuda() || use_metal<T> ();
108 template<
float_scalar T>
110 if (max_size <= std::numeric_limits<unsigned char>::max()) {
111 if constexpr (jit::use_metal<T> ()) {
116 }
else if (max_size <= std::numeric_limits<unsigned short>::max()) {
117 if constexpr (jit::use_metal<T> ()) {
122 }
else if (max_size <= std::numeric_limits<unsigned int>::max()) {
123 if constexpr (jit::use_metal<T> ()) {
129 if constexpr (jit::use_metal<T> ()) {
144 template<
float_scalar T>
148 return "cuda::std::complex<" + type_to_string<T> () +
">";
150 return "std::complex<" + type_to_string<T> () +
">";
153 return type_to_string<T> ();
164 template<
float_scalar T>
166 stream << get_type_string<T> ();
176 template<
float_scalar T>
179 return std::numeric_limits<float>::max_digits10;
181 return std::numeric_limits<double>::max_digits10;
192 template<
float_scalar T>
195 return static_cast<T
> (std::numeric_limits<float>::max());
197 return static_cast<T
> (std::numeric_limits<double>::max());
214 std::array<char, 36> buffer;
216 if constexpr (std::is_same<T, size_t>::value) {
217 end = std::to_chars(buffer.begin(),
224 end = std::to_chars(buffer.begin(), buffer.end(),
225 value, std::chars_format::general,
226 max_digits10<T> ()).ptr;
228 return std::string(buffer.data(), end);
248 const NODE *pointer) {
249 assert((prefix ==
'r' || prefix ==
'v' ||
250 prefix ==
'o' || prefix ==
'a' ||
251 prefix ==
'i' || prefix ==
's' ||
252 prefix ==
'l' || prefix ==
't') &&
253 "Expected a variable (v), register (r), output (o), array (a), index (i), state (s), logical (l), or (t) thread prefix.");
254 return std::string(1, prefix) +
278 template<
float_scalar T>
289 return std::abs(left) < std::abs(right);
Define a custom comparator class.
Definition register.hpp:279
bool operator()(const T &left, const T &right) const
Call operator.
Definition register.hpp:287
Complex scalar concept.
Definition register.hpp:25
Double base concept.
Definition register.hpp:43
float base concept.
Definition register.hpp:38
Float scalar concept.
Definition register.hpp:30
General scalar concept.
Definition register.hpp:34
subroutine assert(test, message)
Assert check.
Definition f_binding_test.f90:38
Name space for JIT functions.
Definition jit.hpp:41
constexpr bool use_gpu()
Test to use the GPU.
Definition register.hpp:96
std::unordered_set< void * > visiter_map
Type alias for listing visited nodes.
Definition register.hpp:263
constexpr bool use_metal()
Test to use metal.
Definition register.hpp:82
std::string type_to_string()
Convert a base type to a string.
Definition register.hpp:57
std::string format_to_string(const T value)
Convert a value to a string while avoiding locale.
Definition register.hpp:213
std::unordered_map< void *, size_t > register_usage
Type alias for counting register usage.
Definition register.hpp:261
std::unordered_set< std::string > preamble_map
Type alias for preamble defined functions.
Definition register.hpp:269
void add_type(std::basic_ostream< char > &stream)
Write out the node base type to a general stream.
Definition register.hpp:165
std::string smallest_uint_type(const size_t max_size)
Get smallest integer type.
Definition register.hpp:109
constexpr T max_base()
The maximum value for a base type.
Definition register.hpp:193
std::unordered_map< void *, std::string > register_map
Type alias for mapping node pointers to register names.
Definition register.hpp:259
std::string get_type_string()
Get the type string.
Definition register.hpp:145
constexpr bool use_cuda()
Test to use Cuda.
Definition register.hpp:68
constexpr int max_digits10()
The maximum number of digits to represent a type literal.
Definition register.hpp:177
std::unordered_map< void *, std::array< size_t, 2 > > texture2d_list
Type alias for indexing 2D textures.
Definition register.hpp:267
std::unordered_map< void *, size_t > texture1d_list
Type alias for indexing 1D textures.
Definition register.hpp:265
std::string to_string(const char prefix, const NODE *pointer)
Convert a graph::leaf_node pointer to a string.
Definition register.hpp:247
std::unordered_set< void * > argument_set
Type for tacking thread shared memory.
Definition register.hpp:271