-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement sycl::vec (without multi-component swizzles)
- Loading branch information
Showing
7 changed files
with
523 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,34 @@ | ||
#pragma once | ||
|
||
#include <utility> | ||
|
||
namespace simsycl::detail { | ||
|
||
template<typename T, typename T2> | ||
auto div_ceil(T a, T2 b) { | ||
constexpr auto div_ceil(T a, T2 b) { | ||
return (a + b - 1) / b; | ||
} | ||
|
||
template<typename T> | ||
constexpr T &&max(T &&x) { | ||
return std::forward<T>(x); | ||
} | ||
|
||
template<typename T, typename... Ts> | ||
constexpr decltype(auto) max(T &&x, Ts &&...ts) { | ||
decltype(auto) rhs = max(std::forward<Ts>(ts)...); | ||
return x < rhs ? std::forward<decltype(rhs)>(rhs) : std::forward<T>(x); | ||
} | ||
|
||
template<typename T> | ||
constexpr T &&min(T &&x) { | ||
return std::forward<T>(x); | ||
} | ||
|
||
template<typename T, typename... Ts> | ||
constexpr decltype(auto) min(T &&x, Ts &&...ts) { | ||
decltype(auto) rhs = min(std::forward<Ts>(ts)...); | ||
return x < rhs ? std::forward<T>(x) : std::forward<decltype(rhs)>(rhs); | ||
} | ||
|
||
} // namespace simsycl::detail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ | |
#include "sycl/sub_group.hh" | ||
#include "sycl/type_traits.hh" | ||
#include "sycl/usm.hh" | ||
#include "sycl/vec.hh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.