ReUseX
0.0.5
3D Point Cloud Processing for Building Reuse
Toggle main menu visibility
Loading...
Searching...
No Matches
transpose.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2
//
3
// SPDX-License-Identifier: GPL-3.0-or-later
4
5
#pragma once
6
7
namespace
reusex::vision::tensor_rt
{
8
9
// Rearrange a device buffer from spatial [C,H,W] (index c*H*W + h*W + w) to
10
// seq-major [H*W,C] (index (h*W+w)*C + c), out-of-place. `src` and `dst` must
11
// be distinct device allocations of at least C*H*W floats.
12
//
13
// Enqueued on `stream` (a cudaStream_t, taken as void* so consumers do not need
14
// the CUDA headers) and never synchronises: the caller keeps ordering through
15
// the stream. No-op for a degenerate (non-positive) extent.
16
void
chw_to_hwc
(
const
float
*src,
float
*dst,
int
c,
int
h,
int
w,
17
void
*stream);
18
19
// Verification / benchmarking entry point: upload `h_src` ([C,H,W], C*H*W
20
// floats), run the transpose kernel `iters` times on a private stream, and
21
// download the result into `h_dst` ([H*W,C]). Returns the mean per-iteration
22
// kernel time in milliseconds (measured with CUDA events), or a negative value
23
// if no CUDA device is usable. Not used on the inference path — the per-frame
24
// path calls chw_to_hwc() on device buffers it already owns.
25
double
chw_to_hwc_device_roundtrip
(
const
float
*h_src,
float
*h_dst,
int
c,
26
int
h,
int
w,
int
iters = 1);
27
28
}
// namespace reusex::vision::tensor_rt
reusex::vision::tensor_rt
Definition
Backend.hpp:11
reusex::vision::tensor_rt::chw_to_hwc_device_roundtrip
double chw_to_hwc_device_roundtrip(const float *h_src, float *h_dst, int c, int h, int w, int iters=1)
reusex::vision::tensor_rt::chw_to_hwc
void chw_to_hwc(const float *src, float *dst, int c, int h, int w, void *stream)
libs
reusex
include
vision
tensor_rt
kernels
transpose.hpp
Generated by
1.17.0