Skip to content

Commit

Permalink
[cudadev] Added size support in views and range checking.
Browse files Browse the repository at this point in the history
Views can now only be defined from layouts and view of the same size (if multiple).
  • Loading branch information
ericcano committed Jan 14, 2022
1 parent f89caec commit 9ad2ba7
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class SiPixelROCsStatusAndMappingWrapper {
// Populate the view with individual column pointers
auto & cmd = *cablingMapDevice;
cablingMapDeviceView = SiPixelROCsStatusAndMappingConstView(
pixelgpudetails::MAX_SIZE,
cmd.fed, // Those are array pointers (in device, but we won't dereference them here).
cmd.link,
cmd.roc,
Expand Down
9 changes: 9 additions & 0 deletions src/cudadev/DataFormats/SoACommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,21 @@
#define SOA_DEVICE_RESTRICT
#endif

// Exception throwing (or willful crash in kernels)
#if defined(__CUDACC__) && defined(__CUDA_ARCH__)
#define SOA_THROW_OUT_OF_RANGE(A) { printf (A); *((char *)nullptr) = 0; }
#else
#define SOA_THROW_OUT_OF_RANGE(A) { throw std::out_of_range(A); }
#endif

// compile-time sized SoA

namespace cms::soa {

enum class RestrictQualify : bool { Enabled, Disabled, Default = Disabled };

enum class RangeChecking: bool { Enabled, Disabled, Default = Disabled };

template <typename T, RestrictQualify RESTRICT_QUALIFY>
struct add_restrict {};

Expand Down
Loading

0 comments on commit 9ad2ba7

Please sign in to comment.