chrono_batch_render/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
3 / 3
100.0%
Branches:
1 / 4
25.0%
Functions:
1 / 1
100.0%

stage/views/layout.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 #pragma once
3
4 #include <cstdint>
5 #include <string_view>
6
7 #include <dlpack/dlpack.h>
8
9 #include "chrono_batch_render/device/device.h"
10 #include "chrono_batch_render/device/tensor.h"
11 #include "chrono_batch_render/export.h"
12 #include "chrono_batch_render/stage/schema/schema.h"
13
14 namespace chrono::batch_render {
15
16 struct ColumnLayout {
17 DLDataType dtype;
18 uint32_t lanes;
19 device::DType type;
20 };
21
22 CHRONO_BATCH_RENDER_API ColumnLayout Layout(ColumnType type);
23
24 22 inline bool OnHost(DLDevice device) {
25
1/4
✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
22 return device.device_type == kDLCPU || device.device_type == kDLCUDAHost ||
26 22 device.device_type == kDLROCMHost || device.device_type == kDLCUDAManaged;
27 }
28
29 void CheckReadable(device::Device& device, DLDevice tensor);
30 void WaitOnHost(device::Device& device, Stream producer);
31 uint32_t TensorRows(const DLTensor& tensor, const ColumnLayout& layout, std::string_view field);
32 uint32_t TensorItems(const DLTensor& tensor, const ColumnLayout& layout, uint32_t prims,
33 std::string_view field);
34 const std::byte* TensorBytes(const DLTensor& tensor);
35
36 }
37