Skip to content
This repository was archived by the owner on Aug 20, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions distance.cpp
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
#include <stdexcept>
#include <cstdint>
#include "distance.h"
#include "autocast.h"
#include "dlpack.h"
Expand DownExpand Up@@ -107,7 +108,7 @@ inline void _dt_euclidean(
void dt_euclidean(
DLTensor & inp_out_,
double voxel_spacing,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise a NULL strides field (compact row-major) before dispatch.
Expand DownExpand Up@@ -148,7 +149,7 @@ inline void _dt_l1(
void dt_l1(
DLTensor & inp_out_,
double voxel_spacing,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise a NULL strides field (compact row-major) before dispatch.
Expand DownExpand Up@@ -271,7 +272,7 @@ void dt_spline_table(
const DLTensor & times_,
int8_t spline,
int8_t bound,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand DownExpand Up@@ -394,7 +395,7 @@ void dt_spline_brent(
double step,
int8_t spline,
int8_t bound,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand DownExpand Up@@ -508,7 +509,7 @@ void dt_spline_gaussnewton(
double tol,
int8_t spline,
int8_t bound,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand DownExpand Up@@ -686,7 +687,7 @@ void dt_mesh(
const DLTensor & faces_,
bool _signed,
bool naive,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch. nearest_vertex
Expand Down
12 changes: 6 additions & 6 deletions distance.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,12 +9,12 @@ namespace cpu {
void dt_euclidean(
DLTensor & inp_out ,
double voxel_spacing = 1.0,
int stream = 0
intptr_t stream = 0
);
void dt_l1(
DLTensor & inp_out ,
double voxel_spacing = 1.0,
int stream = 0
intptr_t stream = 0
);
void dt_spline_table(
DLTensor & time ,
Expand All@@ -24,7 +24,7 @@ void dt_spline_table(
const DLTensor & times ,
int8_t spline = 3, // Cubic
int8_t bound = 3, // DCT2
int stream = 0
intptr_t stream = 0
);
void dt_spline_brent(
DLTensor & time ,
Expand All@@ -36,7 +36,7 @@ void dt_spline_brent(
double step ,
int8_t spline = 3, // Cubic
int8_t bound = 3, // DCT2
int stream = 0
intptr_t stream = 0
);
void dt_spline_gaussnewton(
DLTensor & time ,
Expand All@@ -47,7 +47,7 @@ void dt_spline_gaussnewton(
double tol ,
int8_t spline = 3, // Cubic
int8_t bound = 3, // DCT2
int stream = 0
intptr_t stream = 0
);
void dt_mesh(
DLTensor & dist ,
Expand All@@ -57,7 +57,7 @@ void dt_mesh(
const DLTensor & faces ,
bool _signed = true,
bool naive = false,
int stream = 0
intptr_t stream = 0
);

} // namespace cpu
Expand Down
17 changes: 9 additions & 8 deletions posdef.cpp
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
#include <stdexcept>
#include <cstdint>
#include <cmath>
#include "posdef.h"
#include "autocast.h"
Expand DownExpand Up@@ -155,7 +156,7 @@ void sym_matvec(
DLTensor & out_,
const DLTensor & hessian_,
const DLTensor & inp_,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand DownExpand Up@@ -237,7 +238,7 @@ void sym_addmatvec_(
DLTensor & out_,
const DLTensor & hessian_,
const DLTensor & inp_,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand DownExpand Up@@ -271,7 +272,7 @@ void sym_submatvec_(
DLTensor & out_,
const DLTensor & hessian_,
const DLTensor & inp_,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand DownExpand Up@@ -334,7 +335,7 @@ void sym_matvec_backward(
DLTensor & out_, // (*batch, C*(C+1)/2)
const DLTensor & grd_, // (*batch, C)
const DLTensor & inp_, // (*batch, C)
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand DownExpand Up@@ -402,7 +403,7 @@ void sym_solve(
const DLTensor & hessian_,
const DLTensor & inp_,
const DLTensor & weight_,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch. The weight is
Expand DownExpand Up@@ -469,7 +470,7 @@ void sym_solve_(
DLTensor & inp_out_,
const DLTensor & hessian_,
const DLTensor & weight_,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch. The weight is
Expand DownExpand Up@@ -531,7 +532,7 @@ inline void _sym_invert(
void sym_invert(
DLTensor & out_, // (*batch, C*(C+1)/2)
const DLTensor & hessian_, // (*batch, C*(C+1)/2)
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand DownExpand Up@@ -578,7 +579,7 @@ inline void _sym_invert_(

void sym_invert_(
DLTensor & hessian_,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand Down
16 changes: 8 additions & 8 deletions posdef.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,7 +19,7 @@ void sym_matvec(
DLTensor & out ,
const DLTensor & hessian ,
const DLTensor & inp ,
int stream = 0
intptr_t stream = 0
);

// out = d(g' H x)/dH (compact-symmetric gradient of matvec wrt the matrix)
Expand All@@ -28,23 +28,23 @@ void sym_matvec_backward(
DLTensor & out ,
const DLTensor & grd ,
const DLTensor & inp ,
int stream = 0
intptr_t stream = 0
);

// out += H * inp
void sym_addmatvec_(
DLTensor & out ,
const DLTensor & hessian ,
const DLTensor & inp ,
int stream = 0
intptr_t stream = 0
);

// out -= H * inp
void sym_submatvec_(
DLTensor & out ,
const DLTensor & hessian ,
const DLTensor & inp ,
int stream = 0
intptr_t stream = 0
);

// out = (H + diag(weight)) \ inp
Expand All@@ -54,28 +54,28 @@ void sym_solve(
const DLTensor & hessian ,
const DLTensor & inp ,
const DLTensor & weight ,
int stream = 0
intptr_t stream = 0
);

// inp_out = (H + diag(weight)) \ inp_out (in place)
void sym_solve_(
DLTensor & inp_out ,
const DLTensor & hessian ,
const DLTensor & weight ,
int stream = 0
intptr_t stream = 0
);

// out = inv(H) (both in compact-symmetric layout)
void sym_invert(
DLTensor & out ,
const DLTensor & hessian ,
int stream = 0
intptr_t stream = 0
);

// hessian = inv(hessian) (in place, compact-symmetric layout)
void sym_invert_(
DLTensor & hessian ,
int stream = 0
intptr_t stream = 0
);

} // namespace cpu
Expand Down
9 changes: 5 additions & 4 deletions pushpull.cpp
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
#include "pushpull.h"
#include <cstdint>
// VOIDPTR / CHECK_* / DISPATCH_PP and the reduce_t typedef, shared with
// pushpull_backward.cpp so the two translation units cannot drift apart on
// which (order, bound) pairs are statically instantiated.
Expand DownExpand Up@@ -139,7 +140,7 @@ void pull(
int8_t spline,
int8_t bound,
int8_t extrapolate,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand DownExpand Up@@ -192,7 +193,7 @@ void push(
int8_t spline,
int8_t bound,
int8_t extrapolate,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand DownExpand Up@@ -245,7 +246,7 @@ void count(
int8_t spline,
int8_t bound,
int8_t extrapolate,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand DownExpand Up@@ -294,7 +295,7 @@ void grad(
int8_t bound,
int8_t extrapolate,
bool abs,
int /* stream <unused> */
intptr_t /* stream <unused> */
)
{
// Normalise NULL strides (compact row-major) before dispatch.
Expand Down
16 changes: 8 additions & 8 deletions pushpull.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,7 @@ void pull(
int8_t spline = 2,
int8_t bound = 3,
int8_t extrapolate = 1,
int stream = 0
intptr_t stream = 0
);

/**
Expand All@@ -48,7 +48,7 @@ void push(
int8_t spline = 2,
int8_t bound = 3,
int8_t extrapolate = 1,
int stream = 0
intptr_t stream = 0
);

/**
Expand All@@ -61,7 +61,7 @@ void count(
int8_t spline = 2,
int8_t bound = 3,
int8_t extrapolate = 1,
int stream = 0
intptr_t stream = 0
);

/**
Expand All@@ -81,7 +81,7 @@ void grad(
int8_t bound = 3,
int8_t extrapolate = 1,
bool abs = false,
int stream = 0
intptr_t stream = 0
);

/***********************************************************************
Expand DownExpand Up@@ -132,7 +132,7 @@ void pull_backward(
int8_t spline = 2,
int8_t bound = 3,
int8_t extrapolate = 1,
int stream = 0
intptr_t stream = 0
);

/**
Expand All@@ -153,7 +153,7 @@ void push_backward(
int8_t spline = 2,
int8_t bound = 3,
int8_t extrapolate = 1,
int stream = 0
intptr_t stream = 0
);

/**
Expand All@@ -170,7 +170,7 @@ void count_backward(
int8_t spline = 2,
int8_t bound = 3,
int8_t extrapolate = 1,
int stream = 0
intptr_t stream = 0
);

/**
Expand All@@ -194,7 +194,7 @@ void grad_backward(
int8_t bound = 3,
int8_t extrapolate = 1,
bool abs = false,
int stream = 0
intptr_t stream = 0
);

} // namespace cpu
Expand Down
Loading
Loading