Skip to content

Commit 2d51008

Browse files
Marked non-templated function definitions inline
This is to avoid multiple definitions compilation error when using multiple translation units.
1 parent 9089a84 commit 2d51008

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

dpctl/apis/include/dpctl4pybind11.hpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,10 @@ class usm_memory : public py::object
372372
namespace tensor
373373
{
374374

375-
std::vector<py::ssize_t> c_contiguous_strides(int nd,
376-
const py::ssize_t *shape,
377-
py::ssize_t element_size = 1)
375+
inline std::vector<py::ssize_t>
376+
c_contiguous_strides(int nd,
377+
const py::ssize_t *shape,
378+
py::ssize_t element_size = 1)
378379
{
379380
if (nd > 0) {
380381
std::vector<py::ssize_t> c_strides(nd, element_size);
@@ -389,9 +390,10 @@ std::vector<py::ssize_t> c_contiguous_strides(int nd,
389390
}
390391
}
391392

392-
std::vector<py::ssize_t> f_contiguous_strides(int nd,
393-
const py::ssize_t *shape,
394-
py::ssize_t element_size = 1)
393+
inline std::vector<py::ssize_t>
394+
f_contiguous_strides(int nd,
395+
const py::ssize_t *shape,
396+
py::ssize_t element_size = 1)
395397
{
396398
if (nd > 0) {
397399
std::vector<py::ssize_t> f_strides(nd, element_size);
@@ -406,14 +408,14 @@ std::vector<py::ssize_t> f_contiguous_strides(int nd,
406408
}
407409
}
408410

409-
std::vector<py::ssize_t>
411+
inline std::vector<py::ssize_t>
410412
c_contiguous_strides(const std::vector<py::ssize_t> &shape,
411413
py::ssize_t element_size = 1)
412414
{
413415
return c_contiguous_strides(shape.size(), shape.data(), element_size);
414416
}
415417

416-
std::vector<py::ssize_t>
418+
inline std::vector<py::ssize_t>
417419
f_contiguous_strides(const std::vector<py::ssize_t> &shape,
418420
py::ssize_t element_size = 1)
419421
{

dpctl/apis/include/dpctl_capi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
* shared objects defining this symbols, if they call `import_dpctl()`
4949
* prior to using those symbols.
5050
*/
51-
void import_dpctl(void)
51+
static inline void import_dpctl(void)
5252
{
5353
import_dpctl___sycl_device();
5454
import_dpctl___sycl_context();

dpctl/tensor/libtensor/include/kernels/constructors.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ template <typename T> T unbox_py_scalar(py::object o)
5252
return py::cast<T>(o);
5353
}
5454

55-
template <> sycl::half unbox_py_scalar<sycl::half>(py::object o)
55+
template <> inline sycl::half unbox_py_scalar<sycl::half>(py::object o)
5656
{
5757
float tmp = py::cast<float>(o);
5858
return static_cast<sycl::half>(tmp);

0 commit comments

Comments
 (0)