Adjust clang format to the new versions, revert broken macro layout (#714)

This commit is contained in:
Danylo Lytovchenko
2025-08-22 17:23:22 +02:00
committed by GitHub
parent ed877433f3
commit 2ff2316227
189 changed files with 1906 additions and 2418 deletions
+113 -132
View File
@@ -734,13 +734,11 @@ constexpr auto operator"" _catch_sr(char const* rawChars, std::size_t size) noex
f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1))(f, peek, __VA_ARGS__)
#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) \
, \
f(userdata, x) \
CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD))(f, userdata, peek, __VA_ARGS__)
, f(userdata, x) \
CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD))(f, userdata, peek, __VA_ARGS__)
#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) \
, \
f(userdata, x) \
CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD))(f, userdata, peek, __VA_ARGS__)
, f(userdata, x) \
CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD))(f, userdata, peek, __VA_ARGS__)
#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) \
f(userdata, x) \
CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD))(f, userdata, peek, __VA_ARGS__)
@@ -827,8 +825,8 @@ constexpr auto operator"" _catch_sr(char const* rawChars, std::size_t size) noex
return {}; \
} \
template <template <typename...> class...> struct TemplateTypeList {}; \
template <template <typename...> class... Cs> \
constexpr auto get_wrapper() noexcept -> TemplateTypeList<Cs...> { \
template <template <typename...> class... Cs> constexpr auto get_wrapper() noexcept \
-> TemplateTypeList<Cs...> { \
return {}; \
} \
template <typename...> struct append; \
@@ -876,8 +874,8 @@ constexpr auto operator"" _catch_sr(char const* rawChars, std::size_t size) noex
#define INTERNAL_CATCH_NTTP_1(signature, ...) \
template <INTERNAL_CATCH_REMOVE_PARENS(signature)> struct Nttp {}; \
template <INTERNAL_CATCH_REMOVE_PARENS(signature)> \
constexpr auto get_wrapper() noexcept -> Nttp<__VA_ARGS__> { \
template <INTERNAL_CATCH_REMOVE_PARENS(signature)> constexpr auto get_wrapper() noexcept \
-> Nttp<__VA_ARGS__> { \
return {}; \
} \
template <template <INTERNAL_CATCH_REMOVE_PARENS(signature)> class...> \
@@ -950,14 +948,14 @@ constexpr auto operator"" _catch_sr(char const* rawChars, std::size_t size) noex
#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0(TestName, ClassName)
#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1(TestName, ClassName, signature) \
template <typename TestType> \
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<TestType> { \
template <typename TestType> struct TestName \
: INTERNAL_CATCH_REMOVE_PARENS(ClassName)<TestType> { \
void test(); \
}
#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X(TestName, ClassName, signature, ...) \
template <INTERNAL_CATCH_REMOVE_PARENS(signature)> \
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<__VA_ARGS__> { \
template <INTERNAL_CATCH_REMOVE_PARENS(signature)> struct TestName \
: INTERNAL_CATCH_REMOVE_PARENS(ClassName)<__VA_ARGS__> { \
void test(); \
}
@@ -1123,19 +1121,17 @@ struct is_callable_tester {
template <typename T> struct is_callable;
template <typename Fun, typename... Args>
struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {};
template <typename Fun, typename... Args> struct is_callable<Fun(Args...)>
: decltype(is_callable_tester::test<Fun, Args...>(0)) {};
#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703
// std::result_of is deprecated in C++17 and removed in C++20. Hence, it is
// replaced with std::invoke_result here.
template <typename Func, typename... U>
using FunctionReturnType =
template <typename Func, typename... U> using FunctionReturnType =
std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U...>>>;
#else
// Keep ::type here because we still support C++11
template <typename Func, typename... U>
using FunctionReturnType = typename std::remove_reference<
template <typename Func, typename... U> using FunctionReturnType = typename std::remove_reference<
typename std::remove_cv<typename std::result_of<Func(U...)>::type>::type>::type;
#endif
@@ -1556,8 +1552,8 @@ struct AutoReg : NonCopyable {
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \
template <typename TestType> \
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName<TestType>) { \
template <typename TestType> struct TestName \
: INTERNAL_CATCH_REMOVE_PARENS(ClassName<TestType>) { \
void test(); \
}; \
namespace { \
@@ -1632,8 +1628,8 @@ struct AutoReg : NonCopyable {
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \
template <typename TestType> \
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName<TestType>) { \
template <typename TestType> struct TestName \
: INTERNAL_CATCH_REMOVE_PARENS(ClassName<TestType>) { \
void test(); \
}; \
namespace { \
@@ -1813,9 +1809,8 @@ struct IMutableEnumValuesRegistry {
virtual Detail::EnumInfo const& registerEnum(StringRef enumName, StringRef allEnums,
std::vector<int> const& values) = 0;
template <typename E>
Detail::EnumInfo const& registerEnum(StringRef enumName, StringRef allEnums,
std::initializer_list<E> values) {
template <typename E> Detail::EnumInfo const& registerEnum(StringRef enumName, StringRef allEnums,
std::initializer_list<E> values) {
static_assert(sizeof(int) >= sizeof(E), "Cannot serialize enum to int");
std::vector<int> intValues;
intValues.reserve(values.size());
@@ -1892,8 +1887,8 @@ template <typename T> std::string rawMemoryToString(const T& object) {
}
template <typename T> class IsStreamInsertable {
template <typename Stream, typename U>
static auto test(int) -> decltype(std::declval<Stream&>() << std::declval<U>(), std::true_type());
template <typename Stream, typename U> static auto test(int)
-> decltype(std::declval<Stream&>() << std::declval<U>(), std::true_type());
template <typename, typename> static auto test(...) -> std::false_type;
@@ -1936,8 +1931,7 @@ template <typename T> std::string clrReferenceToString(T ^ ref) {
// If we decide for C++14, change these to enable_if_ts
template <typename T, typename = void> struct StringMaker {
template <typename Fake = T>
static
template <typename Fake = T> static
typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
convert(const Fake& value) {
ReusableStringStream rss;
@@ -1947,8 +1941,7 @@ template <typename T, typename = void> struct StringMaker {
return rss.str();
}
template <typename Fake = T>
static
template <typename Fake = T> static
typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
convert(const Fake& value) {
#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER)
@@ -2534,8 +2527,8 @@ template <typename LhsT> class UnaryExpr : public ITransientExpression {
// Specialised comparison functions to handle equality comparisons between ints and pointers (NULL
// deduces as an int)
template <typename LhsT, typename RhsT>
auto compareEqual(LhsT const& lhs, RhsT const& rhs) -> bool {
template <typename LhsT, typename RhsT> auto compareEqual(LhsT const& lhs, RhsT const& rhs)
-> bool {
return static_cast<bool>(lhs == rhs);
}
template <typename T> auto compareEqual(T* const& lhs, int rhs) -> bool {
@@ -3812,8 +3805,8 @@ namespace Catch {
namespace Matchers {
namespace Vector {
template <typename T, typename Alloc>
struct ContainsElementMatcher : MatcherBase<std::vector<T, Alloc>> {
template <typename T, typename Alloc> struct ContainsElementMatcher
: MatcherBase<std::vector<T, Alloc>> {
ContainsElementMatcher(T const& comparator) : m_comparator(comparator) {}
bool match(std::vector<T, Alloc> const& v) const override {
@@ -3832,8 +3825,8 @@ struct ContainsElementMatcher : MatcherBase<std::vector<T, Alloc>> {
T const& m_comparator;
};
template <typename T, typename AllocComp, typename AllocMatch>
struct ContainsMatcher : MatcherBase<std::vector<T, AllocMatch>> {
template <typename T, typename AllocComp, typename AllocMatch> struct ContainsMatcher
: MatcherBase<std::vector<T, AllocMatch>> {
ContainsMatcher(std::vector<T, AllocComp> const& comparator) : m_comparator(comparator) {}
bool match(std::vector<T, AllocMatch> const& v) const override {
@@ -3860,8 +3853,8 @@ struct ContainsMatcher : MatcherBase<std::vector<T, AllocMatch>> {
std::vector<T, AllocComp> const& m_comparator;
};
template <typename T, typename AllocComp, typename AllocMatch>
struct EqualsMatcher : MatcherBase<std::vector<T, AllocMatch>> {
template <typename T, typename AllocComp, typename AllocMatch> struct EqualsMatcher
: MatcherBase<std::vector<T, AllocMatch>> {
EqualsMatcher(std::vector<T, AllocComp> const& comparator) : m_comparator(comparator) {}
bool match(std::vector<T, AllocMatch> const& v) const override {
@@ -3880,8 +3873,8 @@ struct EqualsMatcher : MatcherBase<std::vector<T, AllocMatch>> {
std::vector<T, AllocComp> const& m_comparator;
};
template <typename T, typename AllocComp, typename AllocMatch>
struct ApproxMatcher : MatcherBase<std::vector<T, AllocMatch>> {
template <typename T, typename AllocComp, typename AllocMatch> struct ApproxMatcher
: MatcherBase<std::vector<T, AllocMatch>> {
ApproxMatcher(std::vector<T, AllocComp> const& comparator) : m_comparator(comparator) {}
bool match(std::vector<T, AllocMatch> const& v) const override {
@@ -3913,8 +3906,8 @@ struct ApproxMatcher : MatcherBase<std::vector<T, AllocMatch>> {
mutable Catch::Detail::Approx approx = Catch::Detail::Approx::custom();
};
template <typename T, typename AllocComp, typename AllocMatch>
struct UnorderedEqualsMatcher : MatcherBase<std::vector<T, AllocMatch>> {
template <typename T, typename AllocComp, typename AllocMatch> struct UnorderedEqualsMatcher
: MatcherBase<std::vector<T, AllocMatch>> {
UnorderedEqualsMatcher(std::vector<T, AllocComp> const& target) : m_target(target) {}
bool match(std::vector<T, AllocMatch> const& vec) const override {
if (m_target.size() != vec.size()) {
@@ -4082,8 +4075,7 @@ struct IGeneratorTracker {
namespace Catch {
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
template <typename Ex>
[[noreturn]]
template <typename Ex> [[noreturn]]
void throw_exception(Ex const& e) {
throw e;
}
@@ -4233,8 +4225,7 @@ template <typename T> class Generators : public IGenerator<T> {
}
};
template <typename... Ts>
GeneratorWrapper<std::tuple<Ts...>> table(
template <typename... Ts> GeneratorWrapper<std::tuple<Ts...>> table(
std::initializer_list<std::tuple<typename std::decay<Ts>::type...>> tuples) {
return values<std::tuple<Ts...>>(tuples);
}
@@ -4249,8 +4240,8 @@ auto makeGenerators(GeneratorWrapper<T>&& generator, Gs&&... moreGenerators) ->
template <typename T> auto makeGenerators(GeneratorWrapper<T>&& generator) -> Generators<T> {
return Generators<T>(std::move(generator));
}
template <typename T, typename... Gs>
auto makeGenerators(T&& val, Gs&&... moreGenerators) -> Generators<T> {
template <typename T, typename... Gs> auto makeGenerators(T&& val, Gs&&... moreGenerators)
-> Generators<T> {
return makeGenerators(value(std::forward<T>(val)), std::forward<Gs>(moreGenerators)...);
}
template <typename T, typename U, typename... Gs>
@@ -4342,8 +4333,7 @@ template <typename T, typename Predicate> class FilterGenerator : public IGenera
Predicate m_predicate;
public:
template <typename P = Predicate>
FilterGenerator(P&& pred, GeneratorWrapper<T>&& generator)
template <typename P = Predicate> FilterGenerator(P&& pred, GeneratorWrapper<T>&& generator)
: m_generator(std::move(generator)), m_predicate(std::forward<P>(pred)) {
if (!m_predicate(m_generator.get())) {
// It might happen that there are no values that pass the
@@ -4437,8 +4427,7 @@ template <typename T, typename U, typename Func> class MapGenerator : public IGe
T m_cache;
public:
template <typename F2 = Func>
MapGenerator(F2&& function, GeneratorWrapper<U>&& generator)
template <typename F2 = Func> MapGenerator(F2&& function, GeneratorWrapper<U>&& generator)
: m_generator(std::move(generator)),
m_function(std::forward<F2>(function)),
m_cache(m_function(m_generator.get())) {}
@@ -5099,7 +5088,7 @@ struct EndsWith : StringHolder {
bool match(NSString* str) const override {
return (str != nil || m_substr == nil) &&
[str rangeOfString:m_substr].location == [str length] - [m_substr length];
[str rangeOfString:m_substr].location == [str length] - [m_substr length];
}
std::string describe() const override {
@@ -6490,8 +6479,8 @@ class XmlReporter : public StreamingReporterBase<XmlReporter> {
namespace Catch {
namespace Benchmark {
template <typename Clock> using ClockDuration = typename Clock::duration;
template <typename Clock>
using FloatDuration = std::chrono::duration<double, typename Clock::period>;
template <typename Clock> using FloatDuration =
std::chrono::duration<double, typename Clock::period>;
template <typename Clock> using TimePoint = typename Clock::time_point;
@@ -6542,14 +6531,12 @@ inline void optimizer_barrier() { std::atomic_thread_fence(std::memory_order_seq
template <typename T> inline void deoptimize_value(T&& x) { keep_memory(&x); }
template <typename Fn, typename... Args>
inline auto invoke_deoptimized(Fn&& fn, Args&&... args) ->
template <typename Fn, typename... Args> inline auto invoke_deoptimized(Fn&& fn, Args&&... args) ->
typename std::enable_if<!std::is_same<void, decltype(fn(args...))>::value>::type {
deoptimize_value(std::forward<Fn>(fn)(std::forward<Args...>(args...)));
}
template <typename Fn, typename... Args>
inline auto invoke_deoptimized(Fn&& fn, Args&&... args) ->
template <typename Fn, typename... Args> inline auto invoke_deoptimized(Fn&& fn, Args&&... args) ->
typename std::enable_if<std::is_same<void, decltype(fn(args...))>::value>::type {
std::forward<Fn>(fn)(std::forward<Args...>(args...));
}
@@ -6822,8 +6809,7 @@ template <typename Duration, typename Result> struct Timing {
Result result;
int iterations;
};
template <typename Clock, typename Func, typename... Args>
using TimingOf =
template <typename Clock, typename Func, typename... Args> using TimingOf =
Timing<ClockDuration<Clock>, Detail::CompleteType_t<FunctionReturnType<Func, Args...>>>;
} // namespace Benchmark
} // namespace Catch
@@ -6865,8 +6851,7 @@ TimingOf<Clock, Fun, Chronometer> measure_one(Fun&& fun, int iters, std::true_ty
return {meter.elapsed(), std::move(result), iters};
}
template <typename Clock, typename Fun>
using run_for_at_least_argument_t =
template <typename Clock, typename Fun> using run_for_at_least_argument_t =
typename std::conditional<is_callable<Fun(Chronometer)>::value, Chronometer, int>::type;
struct optimized_away_error : std::exception {
@@ -7301,8 +7286,8 @@ namespace Benchmark {
struct Benchmark {
Benchmark(std::string&& name) : name(std::move(name)) {}
template <class FUN>
Benchmark(std::string&& name, FUN&& func) : fun(std::move(func)), name(std::move(name)) {}
template <class FUN> Benchmark(std::string&& name, FUN&& func)
: fun(std::move(func)), name(std::move(name)) {}
template <typename Clock>
ExecutionPlan<FloatDuration<Clock>> prepare(const IConfig& cfg,
@@ -7715,7 +7700,7 @@ double standard_deviation(std::vector<double>::iterator first, std::vector<doubl
double diff = b - m;
return a + diff * diff;
}) /
(last - first);
(last - first);
return std::sqrt(variance);
}
@@ -7876,8 +7861,8 @@ bool Approx::equalityComparisonImpl(const double other) const {
// First try with fixed margin, then compute margin based on epsilon, scale and Approx's value
// Thanks to Richard Harris for his help refining the scaled margin value
return marginComparison(m_value, other, m_margin) ||
marginComparison(m_value, other,
m_epsilon * (m_scale + std::fabs(std::isinf(m_value) ? 0 : m_value)));
marginComparison(m_value, other,
m_epsilon * (m_scale + std::fabs(std::isinf(m_value) ? 0 : m_value)));
}
void Approx::setMargin(double newMargin) {
@@ -8477,7 +8462,7 @@ class Column {
assert(at <= line().size());
return at == line().size() || (isWhitespace(line()[at]) && !isWhitespace(line()[at - 1])) ||
isBreakableBefore(line()[at]) || isBreakableAfter(line()[at - 1]);
isBreakableBefore(line()[at]) || isBreakableAfter(line()[at - 1]);
}
void calcLength() {
@@ -8560,7 +8545,7 @@ class Column {
auto operator==(iterator const& other) const -> bool {
return m_pos == other.m_pos && m_stringIndex == other.m_stringIndex &&
&m_column == &other.m_column;
&m_column == &other.m_column;
}
auto operator!=(iterator const& other) const -> bool { return !operator==(other); }
};
@@ -8786,7 +8771,7 @@ struct Token {
inline auto isOptPrefix(char c) -> bool {
return c == '-'
#ifdef CATCH_PLATFORM_WINDOWS
|| c == '/'
|| c == '/'
#endif
;
}
@@ -8910,8 +8895,7 @@ template <> class ResultValueBase<void> : public ResultBase {
template <typename T = void> class BasicResult : public ResultValueBase<T> {
public:
template <typename U>
explicit BasicResult(BasicResult<U> const& other)
template <typename U> explicit BasicResult(BasicResult<U> const& other)
: ResultValueBase<T>(other.type()), m_errorMessage(other.errorMessage()) {
assert(type() != ResultBase::Ok);
}
@@ -8975,8 +8959,8 @@ struct HelpColumns {
std::string right;
};
template <typename T>
inline auto convertInto(std::string const& source, T& target) -> ParserResult {
template <typename T> inline auto convertInto(std::string const& source, T& target)
-> ParserResult {
std::stringstream ss;
ss << source;
ss >> target;
@@ -9072,15 +9056,15 @@ template <typename ReturnType> struct LambdaInvoker {
static_assert(std::is_same<ReturnType, ParserResult>::value,
"Lambda must return void or clara::ParserResult");
template <typename L, typename ArgType>
static auto invoke(L const& lambda, ArgType const& arg) -> ParserResult {
template <typename L, typename ArgType> static auto invoke(L const& lambda, ArgType const& arg)
-> ParserResult {
return lambda(arg);
}
};
template <> struct LambdaInvoker<void> {
template <typename L, typename ArgType>
static auto invoke(L const& lambda, ArgType const& arg) -> ParserResult {
template <typename L, typename ArgType> static auto invoke(L const& lambda, ArgType const& arg)
-> ParserResult {
lambda(arg);
return ParserResult::ok(ParseResultType::Matched);
}
@@ -9154,12 +9138,10 @@ template <typename DerivedT> class ParserRefImpl : public ComposableParserImpl<D
explicit ParserRefImpl(std::shared_ptr<BoundRef> const& ref) : m_ref(ref) {}
public:
template <typename T>
ParserRefImpl(T& ref, std::string const& hint)
template <typename T> ParserRefImpl(T& ref, std::string const& hint)
: m_ref(std::make_shared<BoundValueRef<T>>(ref)), m_hint(hint) {}
template <typename LambdaT>
ParserRefImpl(LambdaT const& ref, std::string const& hint)
template <typename LambdaT> ParserRefImpl(LambdaT const& ref, std::string const& hint)
: m_ref(std::make_shared<BoundLambda<LambdaT>>(ref)), m_hint(hint) {}
auto operator()(std::string const& description) -> DerivedT& {
@@ -9193,8 +9175,8 @@ class ExeName : public ComposableParserImpl<ExeName> {
std::shared_ptr<std::string> m_name;
std::shared_ptr<BoundValueRefBase> m_ref;
template <typename LambdaT>
static auto makeRef(LambdaT const& lambda) -> std::shared_ptr<BoundValueRefBase> {
template <typename LambdaT> static auto makeRef(LambdaT const& lambda)
-> std::shared_ptr<BoundValueRefBase> {
return std::make_shared<BoundLambda<LambdaT>>(lambda);
}
@@ -9265,14 +9247,13 @@ class Opt : public ParserRefImpl<Opt> {
std::vector<std::string> m_optNames;
public:
template <typename LambdaT>
explicit Opt(LambdaT const& ref)
template <typename LambdaT> explicit Opt(LambdaT const& ref)
: ParserRefImpl(std::make_shared<BoundFlagLambda<LambdaT>>(ref)) {}
explicit Opt(bool& ref) : ParserRefImpl(std::make_shared<BoundFlagRef>(ref)) {}
template <typename LambdaT>
Opt(LambdaT const& ref, std::string const& hint) : ParserRefImpl(ref, hint) {}
template <typename LambdaT> Opt(LambdaT const& ref, std::string const& hint)
: ParserRefImpl(ref, hint) {}
template <typename T> Opt(T& ref, std::string const& hint) : ParserRefImpl(ref, hint) {}
@@ -9436,7 +9417,7 @@ struct Parser : ParserBase {
for (auto const& cols : rows) {
auto row = TextFlow::Column(cols.left).width(optWidth).indent(2) + TextFlow::Spacer(4) +
TextFlow::Column(cols.right).width(consoleWidth - 7 - optWidth);
TextFlow::Column(cols.right).width(consoleWidth - 7 - optWidth);
os << row << std::endl;
}
}
@@ -9507,8 +9488,7 @@ struct Parser : ParserBase {
}
};
template <typename DerivedT>
template <typename T>
template <typename DerivedT> template <typename T>
auto ComposableParserImpl<DerivedT>::operator|(T const& other) const -> Parser {
return Parser() | static_cast<DerivedT const&>(*this) | other;
}
@@ -9674,7 +9654,8 @@ clara::Parser makeCommandLineParser(ConfigData& config) {
return ParserResult::ok(ParseResultType::Matched);
};
auto cli = ExeName(config.processName) | Help(config.showHelp) |
auto cli =
ExeName(config.processName) | Help(config.showHelp) |
Opt(config.listTests)["-l"]["--list-tests"]("list all/matching test cases") |
Opt(config.listTags)["-t"]["--list-tags"]("list all/matching tags") |
Opt(config.showSuccessfulTests)["-s"]["--success"]("include successful tests in output") |
@@ -9689,38 +9670,38 @@ clara::Parser makeCommandLineParser(ConfigData& config) {
"no. failures")["-x"]["--abortx"]("abort after x failures") |
Opt(setWarning, "warning name")["-w"]["--warn"]("enable warnings") |
Opt(
[&](bool flag) {
config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never;
},
"yes|no")["-d"]["--durations"]("show test durations") |
[&](bool flag) {
config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never;
},
"yes|no")["-d"]["--durations"]("show test durations") |
Opt(config.minDuration, "seconds")["-D"]["--min-duration"](
"show test durations for tests taking at least the given number of seconds") |
"show test durations for tests taking at least the given number of seconds") |
Opt(loadTestNamesFromFile,
"filename")["-f"]["--input-file"]("load test names to run from a file") |
Opt(config.filenamesAsTags)["-#"]["--filenames-as-tags"]("adds a tag for the filename") |
Opt(config.sectionsToRun, "section name")["-c"]["--section"]("specify section to run") |
Opt(setVerbosity, "quiet|normal|high")["-v"]["--verbosity"]("set output verbosity") |
Opt(config.listTestNamesOnly)["--list-test-names-only"](
"list all/matching test cases names only") |
"list all/matching test cases names only") |
Opt(config.listReporters)["--list-reporters"]("list all reporters") |
Opt(setTestOrder, "decl|lex|rand")["--order"]("test case order (defaults to decl)") |
Opt(setRngSeed, "'time'|number")["--rng-seed"]("set a specific seed for random numbers") |
Opt(setColourUsage, "yes|no")["--use-colour"]("should output be colourised") |
Opt(config.libIdentify)["--libidentify"](
"report name and version according to libidentify standard") |
"report name and version according to libidentify standard") |
Opt(setWaitForKeypress,
"never|start|exit|both")["--wait-for-keypress"]("waits for a keypress before exiting") |
Opt(config.benchmarkSamples,
"samples")["--benchmark-samples"]("number of samples to collect (default: 100)") |
Opt(config.benchmarkResamples, "resamples")["--benchmark-resamples"](
"number of resamples for the bootstrap (default: 100000)") |
"number of resamples for the bootstrap (default: 100000)") |
Opt(config.benchmarkConfidenceInterval,
"confidence interval")["--benchmark-confidence-interval"](
"confidence interval for the bootstrap (between 0 and 1, default: 0.95)") |
"confidence interval for the bootstrap (between 0 and 1, default: 0.95)") |
Opt(config.benchmarkNoAnalysis)["--benchmark-no-analysis"](
"perform only measurements; do not perform any analysis") |
"perform only measurements; do not perform any analysis") |
Opt(config.benchmarkWarmupTime, "benchmarkWarmupTime")["--benchmark-warmup-time"](
"amount of time in milliseconds spent on warming up each test (default: 100)") |
"amount of time in milliseconds spent on warming up each test (default: 100)") |
Arg(config.testsOrTags, "test name|pattern|tags")("which test or tests to use");
return cli;
@@ -9742,7 +9723,7 @@ bool SourceLineInfo::operator<(SourceLineInfo const& other) const noexcept {
// We can assume that the same file will usually have the same pointer.
// Thus, if the pointers are the same, there is no point in calling the strcmp
return line < other.line ||
(line == other.line && file != other.file && (std::strcmp(file, other.file) < 0));
(line == other.line && file != other.file && (std::strcmp(file, other.file) < 0));
}
std::ostream& operator<<(std::ostream& os, SourceLineInfo const& info) {
@@ -9900,10 +9881,10 @@ class Win32ColourImpl : public IColourImpl {
Win32ColourImpl() : stdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)) {
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(stdoutHandle, &csbiInfo);
originalForegroundAttributes = csbiInfo.wAttributes &
~(BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY);
originalBackgroundAttributes = csbiInfo.wAttributes &
~(FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
originalForegroundAttributes = csbiInfo.wAttributes & ~(BACKGROUND_GREEN | BACKGROUND_RED |
BACKGROUND_BLUE | BACKGROUND_INTENSITY);
originalBackgroundAttributes = csbiInfo.wAttributes & ~(FOREGROUND_GREEN | FOREGROUND_RED |
FOREGROUND_BLUE | FOREGROUND_INTENSITY);
}
void use(Colour::Code _colourCode) override {
@@ -11062,10 +11043,10 @@ std::size_t listReporters() {
for (auto const& factoryKvp : factories) {
Catch::cout() << Column(factoryKvp.first + ":").indent(2).width(5 + maxNameLen) +
Column(factoryKvp.second->getDescription())
.initialIndent(0)
.indent(2)
.width(CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen - 8)
Column(factoryKvp.second->getDescription())
.initialIndent(0)
.indent(2)
.width(CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen - 8)
<< "\n";
}
Catch::cout() << std::endl;
@@ -11253,7 +11234,7 @@ bool WithinAbsMatcher::match(double const& matchee) const {
std::string WithinAbsMatcher::describe() const {
return "is within " + ::Catch::Detail::stringify(m_margin) + " of " +
::Catch::Detail::stringify(m_target);
::Catch::Detail::stringify(m_target);
}
WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, FloatingPointKind baseType)
@@ -11449,8 +11430,8 @@ bool RegexMatcher::match(std::string const& matchee) const {
std::string RegexMatcher::describe() const {
return "matches " + ::Catch::Detail::stringify(m_regex) +
((m_caseSensitivity == CaseSensitive::Choice::Yes) ? " case sensitively"
: " case insensitively");
((m_caseSensitivity == CaseSensitive::Choice::Yes) ? " case sensitively"
: " case insensitively");
}
} // namespace StdString
@@ -13169,8 +13150,8 @@ Catch::IStream::~IStream() = default;
namespace Detail {
namespace {
template <typename WriterF, std::size_t bufferSize = 256>
class StreamBufImpl : public std::streambuf {
template <typename WriterF, std::size_t bufferSize = 256> class StreamBufImpl
: public std::streambuf {
char data[bufferSize];
WriterF m_writer;
@@ -13491,7 +13472,7 @@ std::string TagAliasRegistry::expandAliases(std::string const& unexpandedTestSpe
std::size_t pos = expandedTestSpec.find(registryKvp.first);
if (pos != std::string::npos) {
expandedTestSpec = expandedTestSpec.substr(0, pos) + registryKvp.second.tag +
expandedTestSpec.substr(pos + registryKvp.first.size());
expandedTestSpec.substr(pos + registryKvp.first.size());
}
}
return expandedTestSpec;
@@ -13544,7 +13525,7 @@ TestCaseInfo::SpecialProperties parseSpecialTag(std::string const& tag) {
}
bool isReservedTag(std::string const& tag) {
return parseSpecialTag(tag) == TestCaseInfo::None && tag.size() > 0 &&
!std::isalnum(static_cast<unsigned char>(tag[0]));
!std::isalnum(static_cast<unsigned char>(tag[0]));
}
void enforceNotReservedTag(std::string const& tag, SourceLineInfo const& _lineInfo) {
CATCH_ENFORCE(
@@ -13758,11 +13739,11 @@ void enforceNoDuplicateTestCases(std::vector<TestCase> const& functions) {
std::set<TestCase> seenFunctions;
for (auto const& function : functions) {
auto prev = seenFunctions.insert(function);
CATCH_ENFORCE(prev.second,
"error: TEST_CASE( \""
<< function.name << "\" ) already defined.\n"
<< "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n"
<< "\tRedefined at " << function.getTestCaseInfo().lineInfo);
CATCH_ENFORCE(prev.second, "error: TEST_CASE( \""
<< function.name << "\" ) already defined.\n"
<< "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo
<< "\n"
<< "\tRedefined at " << function.getTestCaseInfo().lineInfo);
}
}
@@ -13884,7 +13865,7 @@ ITrackerPtr TrackerBase::findChild(NameAndLocation const& nameAndLocation) {
auto it = std::find_if(m_children.begin(), m_children.end(),
[&nameAndLocation](ITrackerPtr const& tracker) {
return tracker->nameAndLocation().location == nameAndLocation.location &&
tracker->nameAndLocation().name == nameAndLocation.name;
tracker->nameAndLocation().name == nameAndLocation.name;
});
return (it != m_children.end()) ? *it : nullptr;
}
@@ -14077,7 +14058,7 @@ TestSpec::TagPattern::TagPattern(std::string const& tag, std::string const& filt
bool TestSpec::TagPattern::matches(TestCaseInfo const& testCase) const {
return std::find(begin(testCase.lcaseTags), end(testCase.lcaseTags), m_tag) !=
end(testCase.lcaseTags);
end(testCase.lcaseTags);
}
TestSpec::ExcludedPattern::ExcludedPattern(PatternPtr const& underlyingPattern)
@@ -15751,8 +15732,8 @@ class TablePrinter {
auto colInfo = tp.m_columnInfos[tp.m_currentColumn];
auto padding = (strSize + 1 < static_cast<std::size_t>(colInfo.width))
? std::string(colInfo.width - (strSize + 1), ' ')
: std::string();
? std::string(colInfo.width - (strSize + 1), ' ')
: std::string();
if (colInfo.justification == ColumnInfo::Left)
tp.m_os << colStr << padding << ' ';
else
+4 -6
View File
@@ -346,7 +346,7 @@ IS(object, object)
template <> inline bool value::is<double>() const {
return type_ == number_type
#ifdef PICOJSON_USE_INT64
|| type_ == int64_type
|| type_ == int64_type
#endif
;
}
@@ -365,11 +365,9 @@ GET(std::string, *u_.string_)
GET(array, *u_.array_)
GET(object, *u_.object_)
#ifdef PICOJSON_USE_INT64
GET(double,
(type_ == int64_type &&
(const_cast<value*>(this)->type_ = number_type,
(const_cast<value*>(this)->u_.number_ = u_.int64_)),
u_.number_))
GET(double, (type_ == int64_type && (const_cast<value*>(this)->type_ = number_type,
(const_cast<value*>(this)->u_.number_ = u_.int64_)),
u_.number_))
GET(int64_t, u_.int64_)
#else
GET(double, u_.number_)
@@ -114,7 +114,7 @@ std::string TestContext::getMatchingConfigFile(std::string config_dir) {
std::string cur_arch = getCurrentArch();
LogPrintf("The arch present: %s", cur_arch.c_str());
configFileToUse = config_dir + "/config_" + getConfig().platform + "_" + getConfig().os + "_" +
cur_arch + ".json";
cur_arch + ".json";
} else {
configFileToUse =
config_dir + "/config_" + getConfig().platform + "_" + getConfig().os + ".json";
@@ -31,8 +31,7 @@ THE SOFTWARE.
* Contains performance tests for kernel launch overhead benchmarking.
*/
template <KernelType kernel_type, bool timer_type>
class ExtLaunchKernelBenchmark
template <KernelType kernel_type, bool timer_type> class ExtLaunchKernelBenchmark
: public KernelLaunchBenchmark<ExtLaunchKernelBenchmark<kernel_type, timer_type>, timer_type> {
public:
constexpr void LaunchKernel() {
@@ -32,8 +32,7 @@ THE SOFTWARE.
* Contains performance tests for kernel launch overhead benchmarking.
*/
template <KernelType kernel_type, bool timer_type>
class LaunchCooperativeKernelBenchmark
template <KernelType kernel_type, bool timer_type> class LaunchCooperativeKernelBenchmark
: public KernelLaunchBenchmark<LaunchCooperativeKernelBenchmark<kernel_type, timer_type>,
timer_type> {
public:
@@ -31,8 +31,7 @@ THE SOFTWARE.
* Contains performance tests for kernel launch overhead benchmarking.
*/
template <KernelType kernel_type, bool timer_type>
class LaunchKernelBenchmark
template <KernelType kernel_type, bool timer_type> class LaunchKernelBenchmark
: public KernelLaunchBenchmark<LaunchKernelBenchmark<kernel_type, timer_type>, timer_type> {
public:
constexpr void LaunchKernel() {
@@ -31,8 +31,7 @@ THE SOFTWARE.
* Contains performance tests for kernel launch overhead benchmarking.
*/
template <KernelType kernel_type, bool timer_type>
class TripleChevronBenchmark
template <KernelType kernel_type, bool timer_type> class TripleChevronBenchmark
: public KernelLaunchBenchmark<TripleChevronBenchmark<kernel_type, timer_type>, timer_type> {
public:
constexpr void LaunchKernel() {
@@ -68,9 +68,9 @@ class MemcpyHtoDKernelDtoHv2AsyncBenchmark
REQUIRE(sum == count * (count - 1) / 2);
}
};
template <typename BenchmarkType>
static void RunBenchmark(LinearAllocs host_allocation_type, LinearAllocs device_allocation_type,
size_t size) {
template <typename BenchmarkType> static void RunBenchmark(LinearAllocs host_allocation_type,
LinearAllocs device_allocation_type,
size_t size) {
BenchmarkType benchmark;
if (size < 1_KB) {
benchmark.AddSectionName(std::to_string(size));
@@ -124,8 +124,8 @@ __global__ void reduceOpSync(T* __restrict__ output, const T* __restrict__ input
}
}
template <class T, template <typename> class Op>
class AtomicBenchmark : public Benchmark<AtomicBenchmark<T, Op>> {
template <class T, template <typename> class Op> class AtomicBenchmark
: public Benchmark<AtomicBenchmark<T, Op>> {
public:
void operator()(T* output, const T* input, int numItems, unsigned long long mask) {
dim3 blockDim = {kBlockDim};
@@ -157,8 +157,8 @@ class AtomicBenchmark : public Benchmark<AtomicBenchmark<T, Op>> {
}
};
template <class T, template <typename> class Op>
class ReduceSyncBenchmark : public Benchmark<ReduceSyncBenchmark<T, Op>> {
template <class T, template <typename> class Op> class ReduceSyncBenchmark
: public Benchmark<ReduceSyncBenchmark<T, Op>> {
public:
void operator()(T* output, T* input, int numItems, unsigned long long mask) {
dim3 blockDim = {kBlockDim};
@@ -30,8 +30,7 @@
using namespace std;
template <unsigned int BLOCKSIZE>
__launch_bounds__(BLOCKSIZE) __global__
template <unsigned int BLOCKSIZE> __launch_bounds__(BLOCKSIZE) __global__
void vectors_not_equal(int n, const double* __restrict__ x, const double* __restrict__ y,
double* __restrict__ workspace) {
int gid = blockIdx.x * blockDim.x + threadIdx.x;
@@ -90,8 +89,7 @@ __launch_bounds__(BLOCKSIZE) __global__
}
}
template <unsigned int BLOCKSIZE>
__launch_bounds__(BLOCKSIZE) __global__
template <unsigned int BLOCKSIZE> __launch_bounds__(BLOCKSIZE) __global__
void vectors_equal(int n, const double* __restrict__ x, double* __restrict__ workspace) {
int gid = blockIdx.x * blockDim.x + threadIdx.x;
@@ -149,8 +147,8 @@ __launch_bounds__(BLOCKSIZE) __global__
}
}
template <unsigned int BLOCKSIZE>
__launch_bounds__(BLOCKSIZE) __global__ void dot_reduction(double* __restrict__ workspace) {
template <unsigned int BLOCKSIZE> __launch_bounds__(BLOCKSIZE) __global__
void dot_reduction(double* __restrict__ workspace) {
__shared__ double sdata[BLOCKSIZE];
sdata[threadIdx.x] = workspace[threadIdx.x];
@@ -44,9 +44,8 @@ coordRec coords[] = {
static unsigned int numCoords = sizeof(coords) / sizeof(coordRec);
template <typename T>
__global__ void float_mad_kernel(uint* out, uint width, T xPos, T yPos, T xStep, T yStep,
uint maxIter) {
template <typename T> __global__ void float_mad_kernel(uint* out, uint width, T xPos, T yPos,
T xStep, T yStep, uint maxIter) {
int tid = (blockIdx.x * blockDim.x + threadIdx.x);
int i = tid % width;
int j = tid / width;
@@ -66,9 +65,9 @@ __global__ void float_mad_kernel(uint* out, uint width, T xPos, T yPos, T xStep,
out[tid] = iter;
}
template <typename T>
__global__ void float_mandel_unroll_kernel(uint* out, uint width, T xPos, T yPos, T xStep, T yStep,
uint maxIter) {
template <typename T> __global__ void float_mandel_unroll_kernel(uint* out, uint width, T xPos,
T yPos, T xStep, T yStep,
uint maxIter) {
int tid = (blockIdx.x * blockDim.x + threadIdx.x);
int i = tid % width;
int j = tid / width;
@@ -169,9 +168,8 @@ __global__ void float_mandel_unroll_kernel(uint* out, uint width, T xPos, T yPos
out[tid] = (uint)ccount;
}
template <typename T>
__global__ void double_mad_kernel(uint* out, uint width, T xPos, T yPos, T xStep, T yStep,
uint maxIter) {
template <typename T> __global__ void double_mad_kernel(uint* out, uint width, T xPos, T yPos,
T xStep, T yStep, uint maxIter) {
int tid = (blockIdx.x * blockDim.x + threadIdx.x);
int i = tid % width;
int j = tid / width;
@@ -191,9 +189,9 @@ __global__ void double_mad_kernel(uint* out, uint width, T xPos, T yPos, T xStep
out[tid] = iter;
};
template <typename T>
__global__ void double_mandel_unroll_kernel(uint* out, uint width, T xPos, T yPos, T xStep, T yStep,
uint maxIter) {
template <typename T> __global__ void double_mandel_unroll_kernel(uint* out, uint width, T xPos,
T yPos, T xStep, T yStep,
uint maxIter) {
int tid = (blockIdx.x * blockDim.x + threadIdx.x);
int i = tid % width;
@@ -548,7 +546,7 @@ bool hipPerfMandelBrot::run(unsigned int testCase) {
// Compute GFLOPS. There are 7 FLOPs per iteration
double perf = (static_cast<double>(totalIters * numKernels) * 7 * static_cast<double>(1e-09)) /
(totalTime / (double)numLoops);
(totalTime / (double)numLoops);
std::vector<std::string> kernelName = {"float", "float_unroll", "double", "double_unroll"};
@@ -143,7 +143,7 @@ static bool hipPerfBufferCopyRectSpeed_test(int p_tests) {
// read speed in GB/s
double perf = (static_cast<double>(bufSize_ * numIter) * static_cast<double>(1e-09)) /
elapsed_secs.count();
elapsed_secs.count();
const char* strSrc = NULL;
const char* strDst = NULL;
@@ -174,13 +174,11 @@ TEST_CASE("Perf_hipPerfHostNumaAlloc_test") {
return;
}
REQUIRE(true ==
runTest(cpuCount, gpuCount, hipHostMallocDefault | hipHostMallocNumaUser,
"Testing hipHostMallocDefault | hipHostMallocNumaUser......"));
REQUIRE(true == runTest(cpuCount, gpuCount, hipHostMallocDefault | hipHostMallocNumaUser,
"Testing hipHostMallocDefault | hipHostMallocNumaUser......"));
REQUIRE(true ==
runTest(cpuCount, gpuCount, hipHostMallocMapped | hipHostMallocNumaUser,
"Testing hipHostMallocMapped | hipHostMallocNumaUser......."));
REQUIRE(true == runTest(cpuCount, gpuCount, hipHostMallocMapped | hipHostMallocNumaUser,
"Testing hipHostMallocMapped | hipHostMallocNumaUser......."));
}
/**
@@ -52,9 +52,8 @@ __host__ __device__ void operator+=(float4& a, float4 b) { // NOLINT
}
#endif
template <typename T>
__global__ void sampleRate(T* outBuffer, unsigned int inBufSize, unsigned int writeIt, T** inBuffer,
int numBufs) {
template <typename T> __global__ void sampleRate(T* outBuffer, unsigned int inBufSize,
unsigned int writeIt, T** inBuffer, int numBufs) {
uint gid = (blockIdx.x * blockDim.x + threadIdx.x);
uint inputIdx = gid % inBufSize;
@@ -69,9 +68,9 @@ __global__ void sampleRate(T* outBuffer, unsigned int inBufSize, unsigned int wr
}
}
template <typename T>
__global__ void sampleRateFloat(T* outBuffer, unsigned int inBufSize, unsigned int writeIt,
T** inBuffer, int numBufs) {
template <typename T> __global__ void sampleRateFloat(T* outBuffer, unsigned int inBufSize,
unsigned int writeIt, T** inBuffer,
int numBufs) {
uint gid = (blockIdx.x * blockDim.x + threadIdx.x);
uint inputIdx = gid % inBufSize;
@@ -179,7 +179,7 @@ static bool hipPerfSharedMemReadSpeed_test() {
// read speed in GB/s
double perf = (static_cast<double>(blocks * threadsPerBlock) *
(numReads1 * sizeof(float) + sharedMemSizeBytes1 / 64) * nIter * (1e-09)) /
all_kernel_time.count();
all_kernel_time.count();
CONSOLE_PRINT(
"info: read speed = %.2f GB/s for %d KB shared memory with %d threads, %d reads in "
@@ -220,7 +220,7 @@ static bool hipPerfSharedMemReadSpeed_test() {
// read speed in GB/s
double perf = (static_cast<double>(blocks * threadsPerBlock) *
(numReads2 * sizeof(float) + sharedMemSizeBytes2 / 64) * nIter * (1e-09)) /
all_kernel_time.count();
all_kernel_time.count();
CONSOLE_PRINT(
"info: read speed = %.2f GB/s for %d KB shared memory with %d threads, %d reads in "
@@ -341,36 +341,32 @@ static bool TestMemoryAllocationInLoop(int test_type, bool isMultikernel = false
* Scenario: Test malloc till nullptr is returned using even chunksize.
*/
TEST_CASE("Stress_deviceAllocation_malloc_Even") {
REQUIRE(true ==
TestAllocationOfAllAvailableMemory(TEST_MALLOC_FREE, NO_ALLOCATION_ONHOST,
MEMORY_CHUNK_SIZE));
REQUIRE(true == TestAllocationOfAllAvailableMemory(TEST_MALLOC_FREE, NO_ALLOCATION_ONHOST,
MEMORY_CHUNK_SIZE));
}
/**
* Scenario: Test malloc till nullptr is returned using odd chunksize.
*/
TEST_CASE("Stress_deviceAllocation_malloc_Odd") {
REQUIRE(true ==
TestAllocationOfAllAvailableMemory(TEST_MALLOC_FREE, NO_ALLOCATION_ONHOST,
MEMORY_CHUNK_SIZE_ODD));
REQUIRE(true == TestAllocationOfAllAvailableMemory(TEST_MALLOC_FREE, NO_ALLOCATION_ONHOST,
MEMORY_CHUNK_SIZE_ODD));
}
/**
* Scenario: Test new till nullptr is returned using even chunksize.
*/
TEST_CASE("Stress_deviceAllocation_new_Even") {
REQUIRE(
true ==
TestAllocationOfAllAvailableMemory(TEST_NEW_DELETE, NO_ALLOCATION_ONHOST, MEMORY_CHUNK_SIZE));
REQUIRE(true == TestAllocationOfAllAvailableMemory(TEST_NEW_DELETE, NO_ALLOCATION_ONHOST,
MEMORY_CHUNK_SIZE));
}
/**
* Scenario: Test new till nullptr is returned using odd chunksize.
*/
TEST_CASE("Stress_deviceAllocation_new_Odd") {
REQUIRE(true ==
TestAllocationOfAllAvailableMemory(TEST_NEW_DELETE, NO_ALLOCATION_ONHOST,
MEMORY_CHUNK_SIZE_ODD));
REQUIRE(true == TestAllocationOfAllAvailableMemory(TEST_NEW_DELETE, NO_ALLOCATION_ONHOST,
MEMORY_CHUNK_SIZE_ODD));
}
/**
@@ -379,9 +375,8 @@ TEST_CASE("Stress_deviceAllocation_new_Odd") {
* from host.
*/
TEST_CASE("Stress_deviceAllocation_malloc_hipmallocmanaged") {
REQUIRE(true ==
TestAllocationOfAllAvailableMemory(TEST_MALLOC_FREE, ALLOCATE_ONHOST_HIPMALLOCMANAGED,
MEMORY_CHUNK_SIZE));
REQUIRE(true == TestAllocationOfAllAvailableMemory(
TEST_MALLOC_FREE, ALLOCATE_ONHOST_HIPMALLOCMANAGED, MEMORY_CHUNK_SIZE));
}
/**
@@ -390,9 +385,8 @@ TEST_CASE("Stress_deviceAllocation_malloc_hipmallocmanaged") {
* from host.
*/
TEST_CASE("Stress_deviceAllocation_new_hipmallocmanaged") {
REQUIRE(true ==
TestAllocationOfAllAvailableMemory(TEST_NEW_DELETE, ALLOCATE_ONHOST_HIPMALLOCMANAGED,
MEMORY_CHUNK_SIZE));
REQUIRE(true == TestAllocationOfAllAvailableMemory(
TEST_NEW_DELETE, ALLOCATE_ONHOST_HIPMALLOCMANAGED, MEMORY_CHUNK_SIZE));
}
/**
@@ -400,9 +394,8 @@ TEST_CASE("Stress_deviceAllocation_new_hipmallocmanaged") {
* is returned. Device memory is also allocated using hipmalloc from host.
*/
TEST_CASE("Stress_deviceAllocation_malloc_hipmalloc") {
REQUIRE(true ==
TestAllocationOfAllAvailableMemory(TEST_MALLOC_FREE, ALLOCATE_ONHOST_HIPMALLOC,
MEMORY_CHUNK_SIZE));
REQUIRE(true == TestAllocationOfAllAvailableMemory(TEST_MALLOC_FREE, ALLOCATE_ONHOST_HIPMALLOC,
MEMORY_CHUNK_SIZE));
}
/**
@@ -410,9 +403,8 @@ TEST_CASE("Stress_deviceAllocation_malloc_hipmalloc") {
* is returned. Device memory is also allocated using hipmalloc from host.
*/
TEST_CASE("Stress_deviceAllocation_new_hipmalloc") {
REQUIRE(true ==
TestAllocationOfAllAvailableMemory(TEST_NEW_DELETE, ALLOCATE_ONHOST_HIPMALLOC,
MEMORY_CHUNK_SIZE));
REQUIRE(true == TestAllocationOfAllAvailableMemory(TEST_NEW_DELETE, ALLOCATE_ONHOST_HIPMALLOC,
MEMORY_CHUNK_SIZE));
}
/**
@@ -439,7 +439,7 @@ TEST_CASE("Stress_printf_ComplexKernelMultStreamMultGpu") {
uint32_t num_blocks = (((MAX_GRID_SIZE * print_limit) / CONST_WEIGHTING_FACT1 -
(CONST_WEIGHTING_FACT2 * print_limit)) *
4) /
numOfGPUs;
numOfGPUs;
TestPassed =
hipPrintfStressTest::testPrintfMultGPU(numOfGPUs, num_blocks, threads_per_block, iterCount);
REQUIRE(TestPassed);
@@ -205,8 +205,8 @@ bool test_printf_conststr(uint32_t num_blocks, uint32_t threads_per_block, uint3
uint32_t sizePrintString = (sizeof(CONST_STR) - 1); // Excluding NULL character
// Calculate the number of iterations from print_limit.
size_t stress_limit_bytes = ((size_t)print_limit * 1024 * 1024 * 1024);
iterCount = static_cast<uint32_t>(
1 + stress_limit_bytes / (num_blocks * threads_per_block * sizePrintString));
iterCount = static_cast<uint32_t>(1 + stress_limit_bytes /
(num_blocks * threads_per_block * sizePrintString));
// Calculate expected lines of print and file size.
uint32_t totalExpectedLines = num_blocks * threads_per_block * iterCount;
size_t expectedFileSize = ((size_t)totalExpectedLines * sizePrintString);
@@ -255,15 +255,15 @@ bool test_printf_two_conditionalstr(uint32_t num_blocks, uint32_t threads_per_bl
avgsizePrintString = (sizePrintStringEven + sizePrintStringOdd) / 2;
// Calculate the number of iterations from print_limit
size_t stress_limit_bytes = ((size_t)print_limit * 1024 * 1024 * 1024);
iterCount = static_cast<uint32_t>(
1 + stress_limit_bytes / (num_blocks * threads_per_block * avgsizePrintString));
iterCount = static_cast<uint32_t>(1 + stress_limit_bytes /
(num_blocks * threads_per_block * avgsizePrintString));
// Calculate expected lines of print and file size.
uint32_t totalExpectedEvenLines, totalExpectedOddLines;
// 0, 1, 2, 3
// 0, 1, 2
totalExpectedEvenLines = ((num_blocks * threads_per_block) % 2 == 0)
? (num_blocks * threads_per_block * iterCount) / 2
: (((num_blocks * threads_per_block) / 2) + 1) * iterCount;
? (num_blocks * threads_per_block * iterCount) / 2
: (((num_blocks * threads_per_block) / 2) + 1) * iterCount;
totalExpectedOddLines = (num_blocks * threads_per_block * iterCount - totalExpectedEvenLines);
size_t expectedFileSize = ((size_t)totalExpectedEvenLines * sizePrintStringEven +
(size_t)totalExpectedOddLines * sizePrintStringOdd);
@@ -322,8 +322,8 @@ bool test_printf_single_conditionalstr(uint32_t num_blocks, uint32_t threads_per
// Calculate expected lines of print and file size.
uint32_t totalExpectedLines;
totalExpectedLines = ((num_blocks * threads_per_block) % 2 == 0)
? (num_blocks * threads_per_block * iterCount) / 2
: (((num_blocks * threads_per_block) / 2) + 1) * iterCount;
? (num_blocks * threads_per_block * iterCount) / 2
: (((num_blocks * threads_per_block) / 2) + 1) * iterCount;
size_t expectedFileSize = (size_t)totalExpectedLines * sizePrintStringEven;
size_t actualFileSize = 0;
uint32_t totalActualLines = 0;
@@ -90,7 +90,8 @@ TEST_CASE("Unit_hipClassKernel_Empty") {
__global__ void sizeClassBKernel(bool* result_ecd) {
int tid = threadIdx.x + blockIdx.x * blockDim.x;
result_ecd[tid] = (sizeof(testSizeB) == 12) && (sizeof(testSizeC) == 16) &&
(sizeof(testSizeP1) == 6) && (sizeof(testSizeP2) == 13) && (sizeof(testSizeP3) == 8);
(sizeof(testSizeP1) == 6) && (sizeof(testSizeP2) == 13) &&
(sizeof(testSizeP3) == 8);
}
TEST_CASE("Unit_hipClassKernel_BSize") {
@@ -107,7 +108,7 @@ TEST_CASE("Unit_hipClassKernel_BSize") {
__global__ void sizeClassKernel(bool* result_ecd) {
int tid = threadIdx.x + blockIdx.x * blockDim.x;
result_ecd[tid] = (sizeof(testSizeA) == 16) && (sizeof(testSizeDerived) == 24) &&
(sizeof(testSizeDerived2) == 20);
(sizeof(testSizeDerived2) == 20);
}
TEST_CASE("Unit_hipClassKernel_Size") {
@@ -124,10 +125,10 @@ TEST_CASE("Unit_hipClassKernel_Size") {
__global__ void sizeVirtualClassKernel(bool* result_ecd, refStructSizes structSizes) {
int tid = threadIdx.x + blockIdx.x * blockDim.x;
result_ecd[tid] = (structSizes.sizeOftestSizeDV == sizeof(testSizeDV)) &&
(structSizes.sizeOftestSizeDerivedDV == sizeof(testSizeDerivedDV)) &&
(structSizes.sizeOftestSizeVirtDer = sizeof(testSizeVirtDer)) &&
(structSizes.sizeOftestSizeVirtDerPack = sizeof(testSizeVirtDerPack)) &&
(structSizes.sizeOftestSizeDerMulti = sizeof(testSizeDerMulti));
(structSizes.sizeOftestSizeDerivedDV == sizeof(testSizeDerivedDV)) &&
(structSizes.sizeOftestSizeVirtDer = sizeof(testSizeVirtDer)) &&
(structSizes.sizeOftestSizeVirtDerPack = sizeof(testSizeVirtDerPack)) &&
(structSizes.sizeOftestSizeDerMulti = sizeof(testSizeDerMulti));
}
TEST_CASE("Unit_hipClassKernel_Virtual") {
@@ -388,9 +388,9 @@ TEST_CASE("Unit_Coalesced_Group_Getters_Via_Non_Member_Functions_Positive_Basic"
}
}
template <typename T>
__global__ void coalesced_group_shfl_up(T* const out, const unsigned int delta,
const uint64_t active_mask) {
template <typename T> __global__ void coalesced_group_shfl_up(T* const out,
const unsigned int delta,
const uint64_t active_mask) {
#if (__GFX8__ || __GFX9__)
constexpr unsigned int ksize = 64;
#else
@@ -468,9 +468,9 @@ TEMPLATE_TEST_CASE("Unit_Coalesced_Group_Shfl_Up_Positive_Basic", "", int, unsig
CoalescedGroupShflUpTestImpl<TestType>();
}
template <typename T>
__global__ void coalesced_group_shfl_down(T* const out, const unsigned int delta,
const uint64_t active_mask) {
template <typename T> __global__ void coalesced_group_shfl_down(T* const out,
const unsigned int delta,
const uint64_t active_mask) {
#if (__GFX8__ || __GFX9__)
constexpr unsigned int ksize = 64;
#else
@@ -558,9 +558,8 @@ TEMPLATE_TEST_CASE("Unit_Coalesced_Group_Shfl_Down_Positive_Basic", "", int, uns
CoalescedGroupShflDownTest<TestType>();
}
template <typename T>
__global__ void coalesced_group_shfl(T* const out, uint8_t* target_lanes,
const uint64_t active_mask) {
template <typename T> __global__ void coalesced_group_shfl(T* const out, uint8_t* target_lanes,
const uint64_t active_mask) {
#if (__GFX8__ || __GFX9__)
constexpr unsigned int ksize = 64;
#else
@@ -240,9 +240,9 @@ static void verify_recorded_values(unsigned int* recorded_values, uint32_t loops
}
}
template <typename F>
static void test_cg_multi_grid_group_type(F kernel_func, int num_devices, int block_size,
bool specific_api_test) {
template <typename F> static void test_cg_multi_grid_group_type(F kernel_func, int num_devices,
int block_size,
bool specific_api_test) {
// Create a stream each device
hipStream_t stream[MaxGPUs];
for (int i = 0; i < num_devices; i++) {
@@ -173,9 +173,9 @@ __global__ void kernel_cg_group_partition_dynamic(unsigned int tile_size, int* r
return;
}
template <typename F>
static void common_group_partition(F kernel_func, unsigned int tile_size, void** params,
size_t num_params, bool use_global_mem) {
template <typename F> static void common_group_partition(F kernel_func, unsigned int tile_size,
void** params, size_t num_params,
bool use_global_mem) {
int block_size = 1;
int threads_per_blk = 64;
@@ -200,8 +200,8 @@ bool isSetScratchLimitSupported() {
std::cout << "Device Id = " << deviceId << " props.major = " << props.major
<< " props.minor = " << props.minor << std::endl;
return ((props.major == 9 && props.minor >= 4) || (props.major == 12 && props.minor >= 5))
? true
: false;
? true
: false;
#else
std::cout << "Only Supported for Linux" << std::endl;
return false;
@@ -244,8 +244,8 @@ TEST_CASE("Unit_hipDeviceGetAttribute_NegTst") {
}
}
template <size_t n>
using AttributeToStringMap = std::array<std::pair<hipDeviceAttribute_t, const char*>, n>;
template <size_t n> using AttributeToStringMap =
std::array<std::pair<hipDeviceAttribute_t, const char*>, n>;
namespace {
@@ -478,11 +478,11 @@ template <typename Type> __global__ void bf16_cvt_to_integral(Type* in, float* o
TEMPLATE_TEST_CASE("Unit_bf16_conversion_to_integral_type", , unsigned short, short, int,
unsigned int) {
constexpr TestType start = std::is_unsigned<TestType>::value
? std::numeric_limits<unsigned short>::min()
: std::numeric_limits<short>::min();
? std::numeric_limits<unsigned short>::min()
: std::numeric_limits<short>::min();
constexpr TestType end = std::is_unsigned<TestType>::value
? std::numeric_limits<unsigned short>::max()
: std::numeric_limits<short>::max();
? std::numeric_limits<unsigned short>::max()
: std::numeric_limits<short>::max();
const size_t size = (start < 0) ? end - start : end + start;
TestType* d_input;
@@ -30,9 +30,9 @@ __device__ static void* dev_ptr[num_threads][GRIDSIZE];
* This kernel allocates and deallocates in every thread
* of every block.
*/
template <typename T>
static __global__ void kerTestDynamicAllocInAllThread(T* outputBuf, int test_type, T value,
size_t perThreadSize) {
template <typename T> static __global__ void kerTestDynamicAllocInAllThread(T* outputBuf,
int test_type, T value,
size_t perThreadSize) {
int myId = threadIdx.x + blockDim.x * blockIdx.x;
// Allocate
size_t size = 0;
@@ -623,8 +623,8 @@ template <typename T> __FP8_DEVICE__ void e4m3_fnuz_fp8_cvt(T val, float* cvt1,
__hip_fp8_e4m3_fnuz tmp1;
tmp1.__x = std::is_same<T, float>::value
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3_FNUZ)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3_FNUZ);
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3_FNUZ)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3_FNUZ);
;
*cvt2 = tmp1;
#else
@@ -641,8 +641,8 @@ template <typename T> __FP8_DEVICE__ void e5m2_fnuz_fp8_cvt(T val, float* cvt1,
__hip_fp8_e5m2_fnuz tmp1;
tmp1.__x = std::is_same<T, float>::value
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2_FNUZ)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2_FNUZ);
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2_FNUZ)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2_FNUZ);
;
*cvt2 = tmp1;
#else
@@ -170,8 +170,8 @@ TEMPLATE_TEST_CASE("Unit_fp8_ocp_correctness", "", float, double) {
__hip_fp8_e4m3 tmp;
tmp.__x = std::is_same<TestType, float>::value
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3);
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3);
;
float cvt2 = tmp;
@@ -440,8 +440,8 @@ TEMPLATE_TEST_CASE("Unit_fp8_ocp_correctness", "", float, double) {
__hip_fp8_e5m2 tmp;
tmp.__x = std::is_same<TestType, float>::value
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2);
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2);
;
float cvt2 = tmp;
@@ -780,8 +780,8 @@ TEMPLATE_TEST_CASE("Unit_fp8_fnuz_correctness", "", float, double) {
__hip_fp8_e4m3_fnuz tmp;
tmp.__x = std::is_same<TestType, float>::value
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3_FNUZ)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3_FNUZ);
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3_FNUZ)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3_FNUZ);
;
float cvt2 = tmp;
@@ -1058,8 +1058,8 @@ TEMPLATE_TEST_CASE("Unit_fp8_fnuz_correctness", "", float, double) {
__hip_fp8_e5m2_fnuz tmp;
tmp.__x = std::is_same<TestType, float>::value
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2_FNUZ)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2_FNUZ);
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2_FNUZ)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2_FNUZ);
;
float cvt2 = tmp;
@@ -629,8 +629,8 @@ template <typename T> __FP8_DEVICE__ void e4m3_ocp_fp8_cvt(T val, float* cvt1, f
__hip_fp8_e4m3 tmp1;
tmp1.__x = std::is_same<T, float>::value
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3);
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3);
;
*cvt2 = tmp1;
#else
@@ -647,8 +647,8 @@ template <typename T> __FP8_DEVICE__ void e5m2_ocp_fp8_cvt(T val, float* cvt1, f
__hip_fp8_e5m2 tmp1;
tmp1.__x = std::is_same<T, float>::value
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2);
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2);
;
*cvt2 = tmp1;
#else
@@ -398,27 +398,27 @@ static bool test_allcomplexMathFunc_host() {
TEST_CASE("Unit_TestMathFuncComplex") {
bool TestPassed = false;
TestPassed = test_makehipComplex_dev<hipFloatComplex, float>() &&
test_makehipComplex_dev<float2, float>() &&
test_makehipComplex_dev<hipDoubleComplex, double>() &&
test_makehipComplex_dev<double2, double>() &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_ADD) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_ADD) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_SUB) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_SUB) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_MUL) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_MUL) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_DIV) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_DIV) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_CONJ) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_CONJ) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_REAL) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_REAL) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_IMAG) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_IMAG) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_SQABS) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_SQABS) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_ABS) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_ABS) &&
test_allcomplexMathFunc_host();
test_makehipComplex_dev<float2, float>() &&
test_makehipComplex_dev<hipDoubleComplex, double>() &&
test_makehipComplex_dev<double2, double>() &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_ADD) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_ADD) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_SUB) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_SUB) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_MUL) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_MUL) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_DIV) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_DIV) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_CONJ) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_CONJ) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_REAL) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_REAL) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_IMAG) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_IMAG) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_SQABS) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_SQABS) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_ABS) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_ABS) &&
test_allcomplexMathFunc_host();
REQUIRE(TestPassed == true);
}
@@ -58,9 +58,9 @@ std::string getName(enum CalcKind CK) {
case CK_##func: \
return std::complex<FloatT>(func(A));
template <typename FloatT>
__device__ __host__ std::complex<FloatT> calc(std::complex<FloatT> A, std::complex<FloatT> B,
enum CalcKind CK) {
template <typename FloatT> __device__ __host__ std::complex<FloatT> calc(std::complex<FloatT> A,
std::complex<FloatT> B,
enum CalcKind CK) {
switch (CK) {
case CK_add:
return A + B;
@@ -79,9 +79,8 @@ __device__ __host__ std::complex<FloatT> calc(std::complex<FloatT> A, std::compl
return A; // To prevent compile warning
}
template <typename FloatT>
__global__ void kernel(std::complex<FloatT>* A, std::complex<FloatT>* B, std::complex<FloatT>* C,
enum CalcKind CK) {
template <typename FloatT> __global__ void kernel(std::complex<FloatT>* A, std::complex<FloatT>* B,
std::complex<FloatT>* C, enum CalcKind CK) {
int tx = threadIdx.x + blockIdx.x * blockDim.x;
C[tx] = calc<FloatT>(A[tx], B[tx], CK);
}
@@ -725,7 +725,7 @@ bool run_erfinvf() {
TEST_CASE("Unit_hipDeviceTrigFunc_Float") {
bool result = false;
result = run_sincosf() && run_sincospif() && run_fdividef() && run_llrintf() && run_norm3df() &&
run_norm4df() && run_normf() && run_rnorm3df() && run_rnorm4df() && run_rnormf() &&
run_lroundf() && run_llroundf() && run_rintf() && run_rhypotf() && run_erfinvf();
run_norm4df() && run_normf() && run_rnorm3df() && run_rnorm4df() && run_rnormf() &&
run_lroundf() && run_llroundf() && run_rintf() && run_rhypotf() && run_erfinvf();
REQUIRE(result == true);
}
@@ -615,7 +615,7 @@ bool run_erfinv() {
TEST_CASE("Unit_hipTrigDeviceFunc_Double") {
bool result = false;
result = run_sincos() && run_sincospi() && run_llrint() && run_norm3d() && run_norm4d() &&
run_rnorm3d() && run_rnorm4d() && run_rnorm() && run_lround() && run_llround() &&
run_rint() && run_rhypot() && run_erfinv();
run_rnorm3d() && run_rnorm4d() && run_rnorm() && run_lround() && run_llround() &&
run_rint() && run_rhypot() && run_erfinv();
REQUIRE(result == true);
}
@@ -324,12 +324,12 @@ __device__ bool check_rnorm4d(double* A) {
__device__ bool check_rnormf(float* A) {
return (rnorm3df(A[0], A[1], A[2]) - rnormf(3, A) < 0.0001) &&
(rnorm4df(A[0], A[1], A[2], A[3]) - rnormf(4, A) < 0.0001);
(rnorm4df(A[0], A[1], A[2], A[3]) - rnormf(4, A) < 0.0001);
}
__device__ bool check_rnorm(double* A) {
return (rnorm3d(A[0], A[1], A[2]) - rnorm(3, A) < 0.0001) &&
(rnorm4d(A[0], A[1], A[2], A[3]) - rnorm(4, A) < 0.0001);
(rnorm4d(A[0], A[1], A[2], A[3]) - rnorm(4, A) < 0.0001);
}
__device__ bool check_sincospif() {
@@ -355,13 +355,13 @@ __device__ bool check_sincospi() {
}
__global__ void testFunctions(bool* result, float* Af, double* A) {
result[0] &= check_erfcinvf() && check_erfcxf() && check_erfcinvf() && check_erfcinv() &&
check_erfcx() && check_erfcinv() && check_fdividef() && check_fdivide() && check_modff() &&
check_modf() && check_nextafterf() && check_norm3df(Af) && check_norm3d(A) &&
check_norm4df(Af) && check_norm4d(A) && check_normcdff() && check_normcdf() &&
check_normcdfinvf() && check_normcdfinv() && check_rcbrtf() && check_rcbrt() &&
check_rhypotf() && check_rhypot() && check_rnorm3df(Af) && check_rnorm3d(A) &&
check_rnorm4df(Af) && check_rnorm4d(A) && check_rnormf(Af) && check_rnorm(A) &&
check_sincospif() && check_sincospi() && check_nextafter();
check_erfcx() && check_erfcinv() && check_fdividef() && check_fdivide() &&
check_modff() && check_modf() && check_nextafterf() && check_norm3df(Af) &&
check_norm3d(A) && check_norm4df(Af) && check_norm4d(A) && check_normcdff() &&
check_normcdf() && check_normcdfinvf() && check_normcdfinv() && check_rcbrtf() &&
check_rcbrt() && check_rhypotf() && check_rhypot() && check_rnorm3df(Af) &&
check_rnorm3d(A) && check_rnorm4df(Af) && check_rnorm4d(A) && check_rnormf(Af) &&
check_rnorm(A) && check_sincospif() && check_sincospi() && check_nextafter();
}
TEST_CASE("Unit_TestDevice_DoublePrecisionMathFunc") {
@@ -259,7 +259,7 @@ TEST_CASE("Unit_hipVectorTypes_test_on_device") {
REQUIRE(res == hipSuccess);
passed = passed &&
run_CheckSharedVectorTypes<
run_CheckSharedVectorTypes<
char1, char2, char3, char4, uchar1, uchar2, uchar3, uchar4, short1, short2, short3,
short4, ushort1, ushort2, ushort3, ushort4, int1, int2, int3, int4, uint1, uint2,
uint3, uint4, long1, long2, long3, long4, ulong1, ulong2, ulong3, ulong4, longlong1,
@@ -66,7 +66,7 @@ __global__ void vectoradd_char4(char4* a, const char4* bm, const char4* cm, int
int i = y * width + x;
if (i < (width * height)) {
a[i] = make_char4(bm[i].x, bm[i].y, bm[i].z, bm[i].w) +
make_char4(cm[i].x, cm[i].y, cm[i].z, cm[i].w);
make_char4(cm[i].x, cm[i].y, cm[i].z, cm[i].w);
}
}
@@ -315,7 +315,7 @@ TEST_CASE("Unit_Test_makechar_functionality") {
bool errors;
errors = dataTypesRunChar1<char1>() && dataTypesRunChar2<char2>() && dataTypesRunChar3<char3>() &&
dataTypesRunChar4<char4>();
dataTypesRunChar4<char4>();
REQUIRE(errors == true);
}
+13 -13
View File
@@ -30,8 +30,7 @@ constexpr int NUM = WIDTH * HEIGHT;
constexpr int THREADS_PER_BLOCK_X = 8;
constexpr int THREADS_PER_BLOCK_Y = 8;
template <typename T>
__global__ void vectoradd_float(T* a, const T* bm, int width, int height)
template <typename T> __global__ void vectoradd_float(T* a, const T* bm, int width, int height)
{
int x = blockDim.x * blockIdx.x + threadIdx.x;
@@ -227,25 +226,26 @@ TEST_CASE("Unit_ldg") {
int errors;
errors = dataTypesRun<char, char>() | dataTypesRun<short, short>() | dataTypesRun<int, int>() |
dataTypesRun<long, long>() | dataTypesRun<long long, long long>() |
dataTypesRun<signed char, signed char>() | dataTypesRun<unsigned char, unsigned char>() |
dataTypesRun<unsigned short, unsigned short>() | dataTypesRun<unsigned int, unsigned int>() |
dataTypesRun<unsigned long, unsigned long>() |
dataTypesRun<unsigned long long, unsigned long long>() | dataTypesRun<float, float>() |
dataTypesRun<double, double>();
dataTypesRun<long, long>() | dataTypesRun<long long, long long>() |
dataTypesRun<signed char, signed char>() | dataTypesRun<unsigned char, unsigned char>() |
dataTypesRun<unsigned short, unsigned short>() |
dataTypesRun<unsigned int, unsigned int>() |
dataTypesRun<unsigned long, unsigned long>() |
dataTypesRun<unsigned long long, unsigned long long>() | dataTypesRun<float, float>() |
dataTypesRun<double, double>();
REQUIRE(errors == 0);
errors = dataTypesRun2<int2, int>() | dataTypesRun2<short2, short>() |
dataTypesRun2<ushort2, unsigned short>() | dataTypesRun2<char2, signed char>() |
dataTypesRun2<uchar2, unsigned char>() | dataTypesRun2<uint2, unsigned int>() |
dataTypesRun2<float2, float>() | dataTypesRun2<double2, double>();
dataTypesRun2<ushort2, unsigned short>() | dataTypesRun2<char2, signed char>() |
dataTypesRun2<uchar2, unsigned char>() | dataTypesRun2<uint2, unsigned int>() |
dataTypesRun2<float2, float>() | dataTypesRun2<double2, double>();
REQUIRE(errors == 0);
errors = dataTypesRun4<int4, int>() | dataTypesRun4<char4, signed char>() |
dataTypesRun4<uchar4, unsigned char>() | dataTypesRun4<short4, short>() |
dataTypesRun4<uint4, unsigned int>() | dataTypesRun4<float4, float>();
dataTypesRun4<uchar4, unsigned char>() | dataTypesRun4<short4, short>() |
dataTypesRun4<uint4, unsigned int>() | dataTypesRun4<float4, float>();
REQUIRE(errors == 0);
}
@@ -33,10 +33,10 @@ constexpr std::array<hipAccessProperty, 3> kAccessProperties{
static bool CompareAccessPolicyWindow(const hipKernelNodeAttrValue& lhs,
const hipKernelNodeAttrValue& rhs) {
return lhs.accessPolicyWindow.base_ptr == rhs.accessPolicyWindow.base_ptr &&
lhs.accessPolicyWindow.num_bytes == rhs.accessPolicyWindow.num_bytes &&
lhs.accessPolicyWindow.hitRatio == rhs.accessPolicyWindow.hitRatio &&
lhs.accessPolicyWindow.hitProp == rhs.accessPolicyWindow.hitProp &&
lhs.accessPolicyWindow.missProp == rhs.accessPolicyWindow.missProp;
lhs.accessPolicyWindow.num_bytes == rhs.accessPolicyWindow.num_bytes &&
lhs.accessPolicyWindow.hitRatio == rhs.accessPolicyWindow.hitRatio &&
lhs.accessPolicyWindow.hitProp == rhs.accessPolicyWindow.hitProp &&
lhs.accessPolicyWindow.missProp == rhs.accessPolicyWindow.missProp;
}
TEST_CASE("Unit_hipGraphKernelNodeSetAttribute_Positive_AccessPolicyWindow") {
@@ -37,9 +37,9 @@ HIP_GRAPH_MEMCPY_FROM_SYMBOL_NODE_DEFINE_ALTERNATE_GLOBALS(int)
HIP_GRAPH_MEMCPY_FROM_SYMBOL_NODE_DEFINE_ALTERNATE_GLOBALS(float)
HIP_GRAPH_MEMCPY_FROM_SYMBOL_NODE_DEFINE_ALTERNATE_GLOBALS(double)
template <typename T>
void GraphMemcpyToSymbolSetParamsShell(const void* symbol, const void* alt_symbol, size_t offset,
const std::vector<T> set_values) {
template <typename T> void GraphMemcpyToSymbolSetParamsShell(const void* symbol,
const void* alt_symbol, size_t offset,
const std::vector<T> set_values) {
const auto f = [alt_symbol, is_arr = set_values.size() > 1](const void* symbol, void* src,
size_t count, size_t offset,
hipMemcpyKind direction) {
@@ -861,14 +861,12 @@ TEST_CASE("Unit_hipStreamBeginCaptureToGraph_Negative") {
HIP_CHECK(hipStreamCreate(&stream));
HIP_CHECK(hipGraphCreate(&graph, 0));
SECTION("Null graph") {
REQUIRE(hipErrorInvalidValue ==
hipStreamBeginCaptureToGraph(stream, nullptr, nullptr, nullptr, 0,
hipStreamCaptureModeGlobal));
REQUIRE(hipErrorInvalidValue == hipStreamBeginCaptureToGraph(stream, nullptr, nullptr, nullptr,
0, hipStreamCaptureModeGlobal));
}
SECTION("Null dependencies") {
REQUIRE(hipErrorInvalidValue ==
hipStreamBeginCaptureToGraph(stream, graph, nullptr, nullptr, 1,
hipStreamCaptureModeGlobal));
REQUIRE(hipErrorInvalidValue == hipStreamBeginCaptureToGraph(stream, graph, nullptr, nullptr, 1,
hipStreamCaptureModeGlobal));
}
SECTION("Invalid mode") {
REQUIRE(hipErrorInvalidValue ==
@@ -39,9 +39,9 @@ __device__ void sum(T* sdata, unsigned groupElements, unsigned tid) {
__syncthreads();
}
template <typename T>
__global__ void testExternSharedKernel(const T* A_d, const T* B_d, T* C_d, size_t numElements,
size_t groupElements) {
template <typename T> __global__ void testExternSharedKernel(const T* A_d, const T* B_d, T* C_d,
size_t numElements,
size_t groupElements) {
// declare dynamic shared memory
extern __shared__ double sdata0[];
T* sdata = reinterpret_cast<T*>(sdata0);
@@ -651,9 +651,8 @@ TEST_CASE("Unit_Device___mul64hi_Sanity_Positive") {
INFO("x1: " << x1);
INFO("x2: " << x2);
REQUIRE(
y.ptr()[0] ==
static_cast<long long>((static_cast<__int128_t>(x1) * static_cast<__int128_t>(x2)) >> 64));
REQUIRE(y.ptr()[0] == static_cast<long long>(
(static_cast<__int128_t>(x1) * static_cast<__int128_t>(x2)) >> 64));
}
__global__ void __umul64hi_kernel(unsigned long long* y, unsigned long long x1,
@@ -685,9 +684,8 @@ TEST_CASE("Unit_Device___umul64hi_Sanity_Positive") {
INFO("x1: " << x1);
INFO("x2: " << x2);
REQUIRE(y.ptr()[0] ==
static_cast<unsigned long long>(
(static_cast<__uint128_t>(x1) * static_cast<__uint128_t>(x2)) >> 64));
REQUIRE(y.ptr()[0] == static_cast<unsigned long long>(
(static_cast<__uint128_t>(x1) * static_cast<__uint128_t>(x2)) >> 64));
}
__global__ void __sad_kernel(unsigned int* y, int x1, int x2, unsigned int x3) {
@@ -749,10 +747,9 @@ TEST_CASE("Unit_Device___usad_Sanity_Positive") {
INFO("x1: " << x1);
INFO("x2: " << x2);
REQUIRE(y.ptr()[0] ==
(static_cast<unsigned int>(
std::abs(static_cast<long long>(x1) - static_cast<long long>(x2))) +
x3));
REQUIRE(y.ptr()[0] == (static_cast<unsigned int>(
std::abs(static_cast<long long>(x1) - static_cast<long long>(x2))) +
x3));
}
__global__ void __byte_perm(unsigned int* y, unsigned int x1, unsigned int x2, unsigned int s) {
@@ -85,9 +85,9 @@ LONG_CONVERSION_FUNCTION_TEST_DEF(llround, std::llround, long long)
TEST_CASE("Unit_Device_llround_llroundf_Negative_RTC") { NegativeTestRTCWrapper<4>(kLlround); }
template <typename T>
__global__ void remquo_kernel(std::pair<T, int>* const ys, const size_t num_xs, T* const x1s,
T* const x2s) {
template <typename T> __global__ void remquo_kernel(std::pair<T, int>* const ys,
const size_t num_xs, T* const x1s,
T* const x2s) {
const auto tid = cg::this_grid().thread_rank();
const auto stride = cg::this_grid().size();
@@ -69,9 +69,8 @@ template <typename T> class DrvMemcpy3DAsync {
};
/* Intializes class variables */
template <typename T>
DrvMemcpy3DAsync<T>::DrvMemcpy3DAsync(int l_width, int l_height, int l_depth,
hipArray_Format l_format) {
template <typename T> DrvMemcpy3DAsync<T>::DrvMemcpy3DAsync(int l_width, int l_height, int l_depth,
hipArray_Format l_format) {
width = l_width;
height = l_height;
depth = l_depth;
@@ -6041,7 +6041,7 @@ TEST_CASE("Unit_hipGetProcAddress_MemoryApisPeerToPeer") {
HIP_CHECK(hipDeviceCanAccessPeer(&canAccessPeer, deviceId, peerDeviceId));
if (!canAccessPeer) {
std::string msg = "Skipped as peer access cannot be enabled between devices " +
std::to_string(deviceId) + " " + std::to_string(peerDeviceId);
std::to_string(deviceId) + " " + std::to_string(peerDeviceId);
HipTest::HIP_SKIP_TEST(msg.c_str());
return;
}
@@ -23,12 +23,12 @@ THE SOFTWARE.
#include <hip_test_common.hh>
namespace hipHostUnregisterTests {
constexpr unsigned int allFlags = hipHostRegisterDefault & // 0
hipHostRegisterPortable & // 1
hipHostRegisterMapped & // 2
hipHostRegisterIoMemory // 4
constexpr unsigned int allFlags = hipHostRegisterDefault & // 0
hipHostRegisterPortable & // 1
hipHostRegisterMapped & // 2
hipHostRegisterIoMemory // 4
#if HT_NVIDIA
& cudaHostRegisterReadOnly; // 8
& cudaHostRegisterReadOnly; // 8
#else
;
#endif
@@ -27,9 +27,8 @@
* - Sets attributes of a memory pool
*/
template <typename T>
static void MemPoolSetGetAttribute(const hipMemPool_t mempool, const hipMemPoolAttr attr,
T& set_value) {
template <typename T> static void MemPoolSetGetAttribute(const hipMemPool_t mempool,
const hipMemPoolAttr attr, T& set_value) {
T get_value = 100;
HIP_CHECK(hipMemPoolSetAttribute(mempool, attr, &set_value));
HIP_CHECK(hipMemPoolGetAttribute(mempool, attr, &get_value));
@@ -77,9 +77,8 @@ template <typename T> void Memcpy3DAsync<T>::SetDefaultData() {
/*
* Constructor initalized width,depth and height
*/
template <typename T>
Memcpy3DAsync<T>::Memcpy3DAsync(int l_width, int l_height, int l_depth,
hipChannelFormatKind l_format) {
template <typename T> Memcpy3DAsync<T>::Memcpy3DAsync(int l_width, int l_height, int l_depth,
hipChannelFormatKind l_format) {
width = l_width;
height = l_height;
depth = l_depth;
@@ -76,9 +76,8 @@ template <typename T> void Memcpy3D<T>::SetDefaultData() {
/*
* Constructor initalized width,depth and height
*/
template <typename T>
Memcpy3D<T>::Memcpy3D(size_t l_width, size_t l_height, size_t l_depth,
hipChannelFormatKind l_format) {
template <typename T> Memcpy3D<T>::Memcpy3D(size_t l_width, size_t l_height, size_t l_depth,
hipChannelFormatKind l_format) {
width = l_width;
height = l_height;
depth = l_depth;
@@ -68,8 +68,8 @@ enum class ops {
};
struct joinable_thread : std::thread {
template <class... Xs>
explicit joinable_thread(Xs&&... xs) : std::thread(std::forward<Xs>(xs)...) {} // NOLINT
template <class... Xs> explicit joinable_thread(Xs&&... xs)
: std::thread(std::forward<Xs>(xs)...) {} // NOLINT
joinable_thread& operator=(joinable_thread&& other) = default;
joinable_thread(joinable_thread&& other) = default;
@@ -65,8 +65,8 @@ template <typename T> class DeviceMemory {
int _offset;
};
template <typename T>
DeviceMemory<T>::DeviceMemory(size_t numElements) : _maxNumElements(numElements), _offset(0) {
template <typename T> DeviceMemory<T>::DeviceMemory(size_t numElements)
: _maxNumElements(numElements), _offset(0) {
T** np = nullptr;
HipTest::initArrays(&_A_d, &_B_d, &_C_d, np, np, np, numElements, 0);
size_t sizeElements = numElements * sizeof(T);
@@ -110,8 +110,7 @@ template <typename T> class HostMemory {
T* _C_h;
};
template <typename T>
HostMemory<T>::HostMemory(size_t numElements, bool usePinnedHost)
template <typename T> HostMemory<T>::HostMemory(size_t numElements, bool usePinnedHost)
: _usePinnedHost(usePinnedHost), _maxNumElements(numElements), _offset(0) {
T** np = nullptr;
HipTest::initArrays(np, np, np, &_A_h, &_B_h, &_C_h, numElements, usePinnedHost);
@@ -199,9 +198,9 @@ void memcpytest2_get_host_memory(size_t* free, size_t* total) {
// (runtime figures out direction). if false, use
// explicit memcpy direction.
//
template <typename T>
void memcpytest2(DeviceMemory<T>* dmem, HostMemory<T>* hmem, size_t numElements, bool useHostToHost,
bool useDeviceToDevice, bool useMemkindDefault) {
template <typename T> void memcpytest2(DeviceMemory<T>* dmem, HostMemory<T>* hmem,
size_t numElements, bool useHostToHost,
bool useDeviceToDevice, bool useMemkindDefault) {
size_t sizeElements = numElements * sizeof(T);
hmem->reset(numElements);
@@ -82,9 +82,8 @@ static bool testhipMemset(T* A_h, T* A_d, T memsetval, enum MemsetType type, siz
}
template <typename T>
static bool testhipMemsetAsync(T* A_h, T* A_d, T memsetval, enum MemsetType type,
size_t numElements) {
template <typename T> static bool testhipMemsetAsync(T* A_h, T* A_d, T memsetval,
enum MemsetType type, size_t numElements) {
size_t Nbytes = numElements * sizeof(T);
bool testResult = true;
constexpr auto MAX_OFFSET = 3; // To memset on unaligned ptr.
@@ -34,9 +34,8 @@ constexpr int testValue2 = 98;
using namespace mem_utils;
// Helper function to run tests for hipMemset allocation types
template <typename T>
void runAsyncTests(hipStream_t stream, allocType type, memType memType, MultiDData data1,
MultiDData data2) {
template <typename T> void runAsyncTests(hipStream_t stream, allocType type, memType memType,
MultiDData data1, MultiDData data2) {
std::pair<T*, T*> aPtr{};
MultiDData totalRange;
totalRange.width = data1.width + data2.width;
@@ -61,9 +60,8 @@ void runAsyncTests(hipStream_t stream, allocType type, memType memType, MultiDDa
}
}
template <typename T>
static void doMemsetTest(allocType mallocType, memType memset_type, MultiDData data1,
MultiDData data2) {
template <typename T> static void doMemsetTest(allocType mallocType, memType memset_type,
MultiDData data1, MultiDData data2) {
enum StreamType { NULLSTR, CREATEDSTR };
auto streamType = GENERATE(NULLSTR, CREATEDSTR);
hipStream_t stream{nullptr};
@@ -182,9 +182,8 @@ DEFINE_1D_BASIC_TEST_CASE("ZeroSize_hipMemsetD8", hipMemsetTypeD8, int8_t, 0x1,
// Helper function that sets a full region of memory with an initial value, sets a smaller subregion
// with another value and check that the memset API do not write outside of the subregion of data.
template <typename T>
void partialMemsetTest(T valA, T valB, size_t count, size_t offset, MemsetType memsetType,
bool async) {
template <typename T> void partialMemsetTest(T valA, T valB, size_t count, size_t offset,
MemsetType memsetType, bool async) {
T* devPtr;
size_t subSize{count - offset};
HIP_CHECK(hipMalloc(&devPtr, count * sizeof(T)));
@@ -250,9 +249,8 @@ void check_device_data_2D(T* devPtr, T value, size_t pitch, size_t width, size_t
// Helper function for allocating memory, setting data with the specified 2D memset API and then
// checking result of operation.
template <typename T>
void checkMemset2D(T value, size_t width, size_t height, bool async = false, size_t pitch = 0,
T* devPtr = nullptr) {
template <typename T> void checkMemset2D(T value, size_t width, size_t height, bool async = false,
size_t pitch = 0, T* devPtr = nullptr) {
hipStream_t stream{nullptr};
HIP_CHECK(hipStreamCreate(&stream));
constexpr size_t elementSize = sizeof(T);
@@ -342,9 +340,9 @@ TEST_CASE("Unit_hipMemsetFunctional_ZeroSize_2D") {
// Helper function that sets a full region of memory with an initial value, sets a smaller subregion
// with another value and check that the memset API do not write outside of the subregion of data.
template <typename T>
void partialMemsetTest2D(T valA, T valB, size_t width, size_t height, size_t widthOffset,
size_t heightOffset, bool async) {
template <typename T> void partialMemsetTest2D(T valA, T valB, size_t width, size_t height,
size_t widthOffset, size_t heightOffset,
bool async) {
T* devPtr{nullptr};
size_t pitch{0};
size_t subWidth{width - widthOffset};
@@ -218,7 +218,7 @@ TEST_CASE("Unit_hipMemset3D_Negative_OutOfBounds") {
HIP_CHECK(hipMalloc3D(&pitchedDevPtr, validExtent));
hipPitchedPtr outOfBoundsPtr{pitchedDevPtr};
outOfBoundsPtr.ptr = reinterpret_cast<char*>(pitchedDevPtr.ptr) +
pitchedDevPtr.pitch * validExtent.height * validExtent.depth + 1;
pitchedDevPtr.pitch * validExtent.height * validExtent.depth + 1;
SECTION("Extent Equal to 0") {
hipExtent zeroExtent{0, 0, 0};
@@ -51,9 +51,9 @@ struct MultiDData {
};
// set of helper functions to tidy the nested switch statements
template <typename T>
static std::pair<T*, T*> deviceMallocHelper(memSetType memType, size_t dataW, size_t dataH,
size_t dataD, size_t& dataPitch) {
template <typename T> static std::pair<T*, T*> deviceMallocHelper(memSetType memType, size_t dataW,
size_t dataH, size_t dataD,
size_t& dataPitch) {
size_t elementSize = sizeof(T);
size_t sizeInBytes = elementSize * dataW * dataH * dataD;
T* aPtr{};
@@ -88,9 +88,8 @@ static std::pair<T*, T*> deviceMallocHelper(memSetType memType, size_t dataW, si
return std::make_pair(aPtr, nullptr);
}
template <typename T>
static std::pair<T*, T*> hostMallocHelper(size_t dataW, size_t dataH, size_t dataD,
size_t& dataPitch) {
template <typename T> static std::pair<T*, T*> hostMallocHelper(size_t dataW, size_t dataH,
size_t dataD, size_t& dataPitch) {
size_t elementSize = sizeof(T);
size_t sizeInBytes = elementSize * dataW * dataH * dataD;
T* aPtr;
@@ -101,9 +100,9 @@ static std::pair<T*, T*> hostMallocHelper(size_t dataW, size_t dataH, size_t dat
return std::make_pair(aPtr, nullptr);
}
template <typename T>
static std::pair<T*, T*> hostRegisteredHelper(size_t dataW, size_t dataH, size_t dataD,
size_t& dataPitch) {
template <typename T> static std::pair<T*, T*> hostRegisteredHelper(size_t dataW, size_t dataH,
size_t dataD,
size_t& dataPitch) {
size_t elementSize = sizeof(T);
size_t sizeInBytes = elementSize * dataW * dataH * dataD;
T* aPtr = new T[dataW * dataH * dataD];
@@ -114,9 +113,9 @@ static std::pair<T*, T*> hostRegisteredHelper(size_t dataW, size_t dataH, size_t
return std::make_pair(aPtr, nullptr);
}
template <typename T>
static std::pair<T*, T*> devRegisteredHelper(size_t dataW, size_t dataH, size_t dataD,
size_t& dataPitch) {
template <typename T> static std::pair<T*, T*> devRegisteredHelper(size_t dataW, size_t dataH,
size_t dataD,
size_t& dataPitch) {
size_t elementSize = sizeof(T);
size_t sizeInBytes = elementSize * dataW * dataH * dataD;
T* aPtr = new T[dataW * dataH * dataD];
@@ -164,9 +163,9 @@ static std::pair<T*, T*> initMemory(allocType type, memSetType memType, MultiDDa
}
// set of helper functions to tidy the nested switch statements
template <typename T>
static void deviceMallocCopy(memSetType memType, T* aPtr, T* hostMem, size_t dataW, size_t dataH,
size_t dataD, size_t& dataPitch) {
template <typename T> static void deviceMallocCopy(memSetType memType, T* aPtr, T* hostMem,
size_t dataW, size_t dataH, size_t dataD,
size_t& dataPitch) {
size_t elementSize = sizeof(T);
size_t sizeInBytes = elementSize * dataW * dataH * dataD;
switch (memType) {
@@ -200,9 +199,8 @@ static void deviceMallocCopy(memSetType memType, T* aPtr, T* hostMem, size_t dat
}
}
template <typename T>
static void hostCopy(memSetType memType, T* aPtr, T* hostMem, size_t dataW, size_t dataH,
size_t dataD, size_t& dataPitch) {
template <typename T> static void hostCopy(memSetType memType, T* aPtr, T* hostMem, size_t dataW,
size_t dataH, size_t dataD, size_t& dataPitch) {
size_t elementSize = sizeof(T);
size_t sizeInBytes = elementSize * dataW * dataH * dataD;
hipMemcpy3DParms params{};
@@ -236,9 +234,9 @@ static void hostCopy(memSetType memType, T* aPtr, T* hostMem, size_t dataW, size
}
}
template <typename T>
static void devRegisteredCopy(memSetType memType, T* aPtr, T* hostMem, size_t dataW, size_t dataH,
size_t dataD, size_t& dataPitch) {
template <typename T> static void devRegisteredCopy(memSetType memType, T* aPtr, T* hostMem,
size_t dataW, size_t dataH, size_t dataD,
size_t& dataPitch) {
size_t elementSize = sizeof(T);
switch (memType) {
@@ -309,9 +307,9 @@ void verifyData(T* aPtr, size_t value, MultiDData& data, allocType type, memSetT
}
// macro to allow reuse of functions for testing versions of hipMemset
template <typename T>
void memsetCheck(T* aPtr, size_t value, memSetType memsetType, MultiDData& data, bool async = false,
hipStream_t stream = nullptr) {
template <typename T> void memsetCheck(T* aPtr, size_t value, memSetType memsetType,
MultiDData& data, bool async = false,
hipStream_t stream = nullptr) {
size_t dataW = data.width;
size_t dataH = data.height == 0 ? 1 : data.height;
size_t dataD = data.depth == 0 ? 1 : data.depth;
@@ -160,9 +160,9 @@ TEST_CASE("Unit_hipExtModuleLaunchKernel_NonUniformWorkGroup") {
HIP_LAUNCH_PARAM_END};
// Memcpy from A to Ad
HIP_CHECK(hipMemcpy(Ad, A, sizeBytes, hipMemcpyDefault));
REQUIRE(hipErrorInvalidValue ==
hipExtModuleLaunchKernel(Function, arraylength, 1, 1, localWorkSize, 1, 1, 0, 0, NULL,
reinterpret_cast<void**>(&config), 0));
REQUIRE(hipErrorInvalidValue == hipExtModuleLaunchKernel(Function, arraylength, 1, 1,
localWorkSize, 1, 1, 0, 0, NULL,
reinterpret_cast<void**>(&config), 0));
HIP_CHECK(hipDeviceSynchronize());
HIP_CHECK(hipFree(Ad));
HIP_CHECK(hipFree(Bd));
@@ -32,5 +32,5 @@ __device__ int getSquareOfGlobalFloat() {
extern "C" __global__ void testWeightedCopy(int* a, int* b) {
int tx = threadIdx.x;
b[tx] = deviceGlobalInt1 * a[tx] + deviceGlobalInt2 + static_cast<int>(deviceGlobalShort) +
static_cast<int>(deviceGlobalChar) + getSquareOfGlobalFloat();
static_cast<int>(deviceGlobalChar) + getSquareOfGlobalFloat();
}
@@ -110,10 +110,9 @@ bool testhipModuleLoadUnloadFunc(const std::vector<char>& buffer, char* globTest
// Check the results
for (size_t idx = 0; idx < N; idx++) {
if (B_h[idx] !=
(deviceGlobalInt1H * A_h[idx] + deviceGlobalInt2H + static_cast<int>(deviceGlobalShortH) +
+static_cast<int>(deviceGlobalCharH) +
static_cast<int>(deviceGlobalFloatH * deviceGlobalFloatH))) {
if (B_h[idx] != (deviceGlobalInt1H * A_h[idx] + deviceGlobalInt2H +
static_cast<int>(deviceGlobalShortH) + +static_cast<int>(deviceGlobalCharH) +
static_cast<int>(deviceGlobalFloatH * deviceGlobalFloatH))) {
// exit the current process with failure
return false;
}
@@ -35,19 +35,15 @@ enum TestType { SameStream = 0, DifferentStreams };
// allocated buffer
template <typename Func, typename T> void threadCall(Func f, hipStream_t stream) {
// Should match hipMemsetAsync or hipMemsetD*Async arguments
static_assert(
(std::is_same<Func,
hipError_t (*)(void*, int, size_t, hipStream_t)>::value || // hipMemsetAsync
std::is_same<Func,
hipError_t (*)(hipDeviceptr_t, int, size_t,
hipStream_t)>::value || // hipMemsetD32Async
std::is_same<Func,
hipError_t (*)(hipDeviceptr_t, unsigned short, size_t,
hipStream_t)>::value || // hipMemsetD16Async
std::is_same<Func,
hipError_t (*)(hipDeviceptr_t, unsigned char, size_t,
hipStream_t)>::value) && // hipMemsetD8Async
"Func f should be hipMemsetAsync or hipMemsetD*Async");
static_assert((std::is_same<Func, hipError_t (*)(void*, int, size_t,
hipStream_t)>::value || // hipMemsetAsync
std::is_same<Func, hipError_t (*)(hipDeviceptr_t, int, size_t,
hipStream_t)>::value || // hipMemsetD32Async
std::is_same<Func, hipError_t (*)(hipDeviceptr_t, unsigned short, size_t,
hipStream_t)>::value || // hipMemsetD16Async
std::is_same<Func, hipError_t (*)(hipDeviceptr_t, unsigned char, size_t,
hipStream_t)>::value) && // hipMemsetD8Async
"Func f should be hipMemsetAsync or hipMemsetD*Async");
constexpr bool cast_2_void =
std::is_same<Func, hipError_t (*)(void*, int, size_t, hipStream_t)>::value;
@@ -104,25 +100,21 @@ template <typename Func, typename T> void launchThreads(Func f, TestType type) {
static_assert(!std::is_pointer<T>::value && "Argument cant be a pointer");
// Should match hipMemsetAsync or hipMemsetD*Async arguments
static_assert(
(std::is_same<Func,
hipError_t (*)(void*, int, size_t, hipStream_t)>::value || // hipMemsetAsync
std::is_same<Func,
hipError_t (*)(hipDeviceptr_t, int, size_t,
hipStream_t)>::value || // hipMemsetD32Async
std::is_same<Func,
hipError_t (*)(hipDeviceptr_t, unsigned short, size_t,
hipStream_t)>::value || // hipMemsetD16Async
std::is_same<Func,
hipError_t (*)(hipDeviceptr_t, unsigned char, size_t,
hipStream_t)>::value) && // hipMemsetD8Async
"Func f should be hipMemsetAsync or hipMemsetD*Async");
static_assert((std::is_same<Func, hipError_t (*)(void*, int, size_t,
hipStream_t)>::value || // hipMemsetAsync
std::is_same<Func, hipError_t (*)(hipDeviceptr_t, int, size_t,
hipStream_t)>::value || // hipMemsetD32Async
std::is_same<Func, hipError_t (*)(hipDeviceptr_t, unsigned short, size_t,
hipStream_t)>::value || // hipMemsetD16Async
std::is_same<Func, hipError_t (*)(hipDeviceptr_t, unsigned char, size_t,
hipStream_t)>::value) && // hipMemsetD8Async
"Func f should be hipMemsetAsync or hipMemsetD*Async");
const size_t num_threads = (std::thread::hardware_concurrency() > 8)
? (((std::thread::hardware_concurrency() / 4) >= 127)
? 127
: (std::thread::hardware_concurrency() / 4))
: 2; // thread count between 2 - 127
? (((std::thread::hardware_concurrency() / 4) >= 127)
? 127
: (std::thread::hardware_concurrency() / 4))
: 2; // thread count between 2 - 127
const size_t num_streams = (type == SameStream) ? 1 : num_threads;
std::vector<hipStream_t> streams(num_streams, nullptr);
@@ -63,7 +63,7 @@ TEST_CASE("Unit_hiprtc_test_hip_bfloat16") {
std::string sarg = std::string("--gpu-architecture=") + props.gcnArchName;
#else
std::string sarg = std::string("--gpu-architecture=compute_") + std::to_string(props.major) +
std::to_string(props.minor);
std::to_string(props.minor);
#endif
vector<const char*> opts;
opts.push_back(sarg.c_str());
@@ -163,7 +163,7 @@ void runAndCompileTest(const std::tuple<Types...> types) {
// call the operator only if the lane is mentioned in the mask
T& result = output[warpSize * i + tid];
result = )" +
intrinsicName + R"((masks[i], input[tid]);
intrinsicName + R"((masks[i], input[tid]);
}
}
})";
@@ -55,7 +55,7 @@ TEST_CASE("Unit_hiprtc_warpsize") {
std::string sarg = std::string("--gpu-architecture=") + props.gcnArchName;
#else
std::string sarg = std::string("--gpu-architecture=compute_") + std::to_string(props.major) +
std::to_string(props.minor);
std::to_string(props.minor);
#endif
vector<const char*> opts;
opts.push_back(sarg.c_str());
@@ -41,8 +41,7 @@ template <typename UIntT, typename... Args> auto writeFunc(Args... args) {
// Random predefined 32 and 64 bit values
using value32_t = std::integral_constant<uint32_t, 0x70F0F0FF>;
using value64_t = std::integral_constant<uint64_t, 0x7FFF0000FFFF0000>;
template <typename UIntT>
using testValue =
template <typename UIntT> using testValue =
typename std::conditional<std::is_same<UIntT, uint32_t>::value, value32_t, value64_t>::type;
constexpr uint32_t DATA_INIT = 0x1234;
@@ -387,18 +386,14 @@ DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("Mask_And",
hipStreamWaitValueAnd, 0xFF, 0xF4A, 0xF35, 0X02))
// Not Using Mask
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_Eq",
TEST_WAIT32(hipStreamWaitValueEq, 0x7FFFFFFF, 0x7FFF0000,
0x7FFFFFFF))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_Gte",
TEST_WAIT32(hipStreamWaitValueGte, 0x7FFF0001, 0x7FFF0000,
0x7FFF0010))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_And",
TEST_WAIT32(hipStreamWaitValueAnd, 0x70F0F0F0, 0x0F0F0F0F,
0X1F0F0F0F))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_Nor",
TEST_WAIT32(hipStreamWaitValueNor, 0x7AAAAAAA, 0x85555555,
0x9AAAAAAA))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_Eq", TEST_WAIT32(hipStreamWaitValueEq, 0x7FFFFFFF,
0x7FFF0000, 0x7FFFFFFF))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_Gte", TEST_WAIT32(hipStreamWaitValueGte, 0x7FFF0001,
0x7FFF0000, 0x7FFF0010))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_And", TEST_WAIT32(hipStreamWaitValueAnd, 0x70F0F0F0,
0x0F0F0F0F, 0X1F0F0F0F))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_Nor", TEST_WAIT32(hipStreamWaitValueNor, 0x7AAAAAAA,
0x85555555, 0x9AAAAAAA))
#undef DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32
@@ -53,9 +53,8 @@ __global__ void surf1DKernelW(hipSurfaceObject_t surfaceObject, T* inputData, in
#endif
}
template <typename T>
__global__ void surf1DKernelRW(hipSurfaceObject_t surfaceObject, hipSurfaceObject_t outputSurfObj,
int width) {
template <typename T> __global__ void surf1DKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
if (x < width) {
@@ -53,9 +53,9 @@ __global__ void surf1DLayeredKernelW(hipSurfaceObject_t surfaceObject, T* inputD
#endif
}
template <typename T>
__global__ void surf1DLayeredKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width) {
template <typename T> __global__ void surf1DLayeredKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj,
int width) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
if (x < width) {
@@ -35,9 +35,8 @@ THE SOFTWARE.
#define LOG_DATA 0
template <typename T>
__global__ void surf2DKernelR(hipSurfaceObject_t surfaceObject, T* outputData, int width,
int height) {
template <typename T> __global__ void surf2DKernelR(hipSurfaceObject_t surfaceObject, T* outputData,
int width, int height) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -47,9 +46,8 @@ __global__ void surf2DKernelR(hipSurfaceObject_t surfaceObject, T* outputData, i
#endif
}
template <typename T>
__global__ void surf2DKernelW(hipSurfaceObject_t surfaceObject, T* inputData, int width,
int height) {
template <typename T> __global__ void surf2DKernelW(hipSurfaceObject_t surfaceObject, T* inputData,
int width, int height) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -59,9 +57,9 @@ __global__ void surf2DKernelW(hipSurfaceObject_t surfaceObject, T* inputData, in
#endif
}
template <typename T>
__global__ void surf2DKernelRW(hipSurfaceObject_t surfaceObject, hipSurfaceObject_t outputSurfObj,
int width, int height) {
template <typename T> __global__ void surf2DKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width,
int height) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -35,9 +35,8 @@ THE SOFTWARE.
#define LOG_DATA 0
template <typename T>
__global__ void surf2DLayeredKernelR(hipSurfaceObject_t surfaceObject, T* outputData, int width,
int height) {
template <typename T> __global__ void surf2DLayeredKernelR(hipSurfaceObject_t surfaceObject,
T* outputData, int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -47,9 +46,8 @@ __global__ void surf2DLayeredKernelR(hipSurfaceObject_t surfaceObject, T* output
#endif
}
template <typename T>
__global__ void surf2DLayeredKernelW(hipSurfaceObject_t surfaceObject, T* inputData, int width,
int height) {
template <typename T> __global__ void surf2DLayeredKernelW(hipSurfaceObject_t surfaceObject,
T* inputData, int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -59,9 +57,9 @@ __global__ void surf2DLayeredKernelW(hipSurfaceObject_t surfaceObject, T* inputD
#endif
}
template <typename T>
__global__ void surf2DLayeredKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width, int height) {
template <typename T> __global__ void surf2DLayeredKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj,
int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -33,9 +33,8 @@ THE SOFTWARE.
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunused-parameter"
template <typename T>
__global__ void surf3DKernelR(hipSurfaceObject_t surfaceObject, T* outputData, int width,
int height, int depth) {
template <typename T> __global__ void surf3DKernelR(hipSurfaceObject_t surfaceObject, T* outputData,
int width, int height, int depth) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -46,9 +45,8 @@ __global__ void surf3DKernelR(hipSurfaceObject_t surfaceObject, T* outputData, i
#endif
}
template <typename T>
__global__ void surf3DKernelW(hipSurfaceObject_t surfaceObject, T* inputData, int width, int height,
int depth) {
template <typename T> __global__ void surf3DKernelW(hipSurfaceObject_t surfaceObject, T* inputData,
int width, int height, int depth) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -59,9 +57,9 @@ __global__ void surf3DKernelW(hipSurfaceObject_t surfaceObject, T* inputData, in
#endif
}
template <typename T>
__global__ void surf3DKernelRW(hipSurfaceObject_t surfaceObject, hipSurfaceObject_t outputSurfObj,
int width, int height, int depth) {
template <typename T> __global__ void surf3DKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width,
int height, int depth) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -35,9 +35,8 @@ THE SOFTWARE.
#define LOG_DATA 0
template <typename T>
__global__ void surfCubemapKernelR(hipSurfaceObject_t surfaceObject, T* outputData, int width,
int height) {
template <typename T> __global__ void surfCubemapKernelR(hipSurfaceObject_t surfaceObject,
T* outputData, int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -47,9 +46,8 @@ __global__ void surfCubemapKernelR(hipSurfaceObject_t surfaceObject, T* outputDa
#endif
}
template <typename T>
__global__ void surfCubemapKernelW(hipSurfaceObject_t surfaceObject, T* inputData, int width,
int height) {
template <typename T> __global__ void surfCubemapKernelW(hipSurfaceObject_t surfaceObject,
T* inputData, int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -59,9 +57,9 @@ __global__ void surfCubemapKernelW(hipSurfaceObject_t surfaceObject, T* inputDat
#endif
}
template <typename T>
__global__ void surfCubemapKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width, int height) {
template <typename T> __global__ void surfCubemapKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj,
int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -35,9 +35,9 @@ THE SOFTWARE.
#define LOG_DATA 0
template <typename T>
__global__ void surfCubemapLayeredKernelR(hipSurfaceObject_t surfaceObject, T* outputData,
int width, int height) {
template <typename T> __global__ void surfCubemapLayeredKernelR(hipSurfaceObject_t surfaceObject,
T* outputData, int width,
int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -47,9 +47,9 @@ __global__ void surfCubemapLayeredKernelR(hipSurfaceObject_t surfaceObject, T* o
#endif
}
template <typename T>
__global__ void surfCubemapLayeredKernelW(hipSurfaceObject_t surfaceObject, T* inputData, int width,
int height) {
template <typename T> __global__ void surfCubemapLayeredKernelW(hipSurfaceObject_t surfaceObject,
T* inputData, int width,
int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -59,10 +59,9 @@ __global__ void surfCubemapLayeredKernelW(hipSurfaceObject_t surfaceObject, T* i
#endif
}
template <typename T>
__global__ void surfCubemapLayeredKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width,
int height) {
template <typename T> __global__ void surfCubemapLayeredKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj,
int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -60,7 +60,7 @@ TEMPLATE_TEST_CASE("Unit_hipTexObjPitch_texture2D", "", char, unsigned char, sho
CHECK_IMAGE_SUPPORT
#if HT_NVIDIA
(void)
hipGetLastError(); // Prevent negative tests affecting this
hipGetLastError(); // Prevent negative tests affecting this
#endif
#if __HIP_NO_IMAGE_SUPPORT
HipTest::HIP_SKIP_TEST("__HIP_NO_IMAGE_SUPPORT is set");
@@ -59,9 +59,8 @@ static __global__ void populateMipmapNextLevelArray(hipSurfaceObject_t surfOut,
#endif
}
template <typename T>
__global__ void getMipmap(hipTextureObject_t texMipmap, unsigned int width, float offsetX,
float lod, T* data = nullptr) {
template <typename T> __global__ void getMipmap(hipTextureObject_t texMipmap, unsigned int width,
float offsetX, float lod, T* data = nullptr) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
float px = 1.0 / float(width);
@@ -69,10 +69,10 @@ static __global__ void populateMipmapNextLevelArray(hipSurfaceObject_t surfOut,
#endif
}
template <typename T>
static __global__ void getMipmap(hipTextureObject_t texMipmap, unsigned int width,
unsigned int height, float offsetX, float offsetY, float lod,
T* data = nullptr) {
template <typename T> static __global__ void getMipmap(hipTextureObject_t texMipmap,
unsigned int width, unsigned int height,
float offsetX, float offsetY, float lod,
T* data = nullptr) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -28,9 +28,9 @@ THE SOFTWARE.
* @ingroup TextureTest
*/
template <bool normalizedCoords>
__global__ void tex1DKernel(float* outputData, hipTextureObject_t textureObject, int width,
float offsetX) {
template <bool normalizedCoords> __global__ void tex1DKernel(float* outputData,
hipTextureObject_t textureObject,
int width, float offsetX) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
outputData[x] =
@@ -22,9 +22,9 @@ THE SOFTWARE.
#include <hip_test_checkers.hh>
#include <hip_texture_helper.hh>
template <bool normalizedCoords>
__global__ void tex1DRGBAKernel(float4* outputData, hipTextureObject_t textureObject, int width,
float offsetX) {
template <bool normalizedCoords> __global__ void tex1DRGBAKernel(float4* outputData,
hipTextureObject_t textureObject,
int width, float offsetX) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
outputData[x] =
@@ -140,9 +140,8 @@ TEST_CASE("Unit_hipMemGetAllocationGranularity_NegativeTests") {
hipMemGetAllocationGranularity(nullptr, &prop, hipMemAllocationGranularityMinimum));
}
SECTION("Prop is nullptr") {
REQUIRE(
hipErrorInvalidValue ==
hipMemGetAllocationGranularity(&granularity, nullptr, hipMemAllocationGranularityMinimum));
REQUIRE(hipErrorInvalidValue == hipMemGetAllocationGranularity(
&granularity, nullptr, hipMemAllocationGranularityMinimum));
}
SECTION("flag is invalid") {
@@ -156,27 +155,23 @@ TEST_CASE("Unit_hipMemGetAllocationGranularity_NegativeTests") {
int numDevices = 0;
HIP_CHECK(hipGetDeviceCount(&numDevices));
prop.location.id = numDevices; // set to non existing device
REQUIRE(
hipErrorInvalidValue ==
hipMemGetAllocationGranularity(&granularity, &prop, hipMemAllocationGranularityMinimum));
REQUIRE(hipErrorInvalidValue == hipMemGetAllocationGranularity(
&granularity, &prop, hipMemAllocationGranularityMinimum));
}
SECTION("device id < lowest device id") {
prop.location.id = -1; // set to non existing device
REQUIRE(
hipErrorInvalidValue ==
hipMemGetAllocationGranularity(&granularity, &prop, hipMemAllocationGranularityMinimum));
REQUIRE(hipErrorInvalidValue == hipMemGetAllocationGranularity(
&granularity, &prop, hipMemAllocationGranularityMinimum));
}
SECTION("allocation type as invalid") {
prop.type = hipMemAllocationTypeInvalid;
REQUIRE(
hipErrorInvalidValue ==
hipMemGetAllocationGranularity(&granularity, &prop, hipMemAllocationGranularityMinimum));
REQUIRE(hipErrorInvalidValue == hipMemGetAllocationGranularity(
&granularity, &prop, hipMemAllocationGranularityMinimum));
}
SECTION("location type as invalid") {
prop.location.type = hipMemLocationTypeInvalid;
REQUIRE(
hipErrorInvalidValue ==
hipMemGetAllocationGranularity(&granularity, &prop, hipMemAllocationGranularityMinimum));
REQUIRE(hipErrorInvalidValue == hipMemGetAllocationGranularity(
&granularity, &prop, hipMemAllocationGranularityMinimum));
}
#endif
}
@@ -81,7 +81,7 @@ TEST_CASE("Unit_hipExternalMemoryGetMappedMipmappedArray_Vulkan_Positive_Read_Wr
HIP_CHECK(hipGetMipmappedArrayLevel(&level_arr, mipmapped_arr, 1));
size_t level_arr_size = mipmapped_arr_desc.extent.width * mipmapped_arr_desc.extent.height *
mipmapped_arr_desc.extent.depth;
mipmapped_arr_desc.extent.depth;
REQUIRE(WriteAndValidateData<type>(level_arr, level_arr_size) == true);
@@ -70,13 +70,12 @@ template <typename T> static void runTestShflXor_2() {
const int size = 64;
T Input[size];
T Output[size];
int Values[size] = {
4, 5, -6, 7, 0, -1, 2, 3, 8, -9, 10, 11, 12, 13, -14, 15, // disabled around mid
// mod-24
20, -21, 22, 23, 16, 17, -18, 19, 28, 29, 30, 31, 24, 25, 26, -27, -32,
33, 34, 35, -36, 37, 38, -39, // disabled around mid mod-24
-44, -45, 46, 47, 40, 41, 42, 43, 52, 53, -54, 55, 48, 49, 50, -51, 56,
57, -58, 59, 60, 61, 62, -63}; // disabled around mid mod-24
int Values[size] = {4, 5, -6, 7, 0, -1, 2, 3, 8, -9, 10, 11, 12, 13, -14, 15, // disabled around
// mid mod-24
20, -21, 22, 23, 16, 17, -18, 19, 28, 29, 30, 31, 24, 25, 26, -27, -32, 33,
34, 35, -36, 37, 38, -39, // disabled around mid mod-24
-44, -45, 46, 47, 40, 41, 42, 43, 52, 53, -54, 55, 48, 49, 50, -51, 56, 57,
-58, 59, 60, 61, 62, -63}; // disabled around mid mod-24
T Expected[size];
initializeInput(Input, size);
@@ -69,7 +69,7 @@ class WarpAll : public WarpVoteTest<WarpAll, uint64_t> {
const auto rank_in_block = this->grid_.thread_rank_in_block(i).value();
const auto rank_in_warp = rank_in_block % this->warp_size_;
const auto warp_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const auto block_rank = warp_idx / this->warps_in_block_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[warp_idx]);
@@ -60,7 +60,7 @@ class WarpAny : public WarpVoteTest<WarpAny, uint64_t> {
const auto rank_in_block = this->grid_.thread_rank_in_block(i).value();
const auto rank_in_warp = rank_in_block % this->warp_size_;
const auto warp_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const auto block_rank = warp_idx / this->warps_in_block_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[warp_idx]);
@@ -59,7 +59,7 @@ class WarpBallot : public WarpVoteTest<WarpBallot, uint64_t> {
const auto rank_in_block = this->grid_.thread_rank_in_block(i).value();
const auto rank_in_warp = rank_in_block % this->warp_size_;
const auto warp_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const auto block_rank = warp_idx / this->warps_in_block_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[warp_idx]);
@@ -31,9 +31,9 @@ THE SOFTWARE.
namespace cg = cooperative_groups;
template <typename T>
__global__ void shfl(T* const out, const T* const in, const uint64_t* const active_masks,
const uint8_t* const src_lanes, const int width) {
template <typename T> __global__ void shfl(T* const out, const T* const in,
const uint64_t* const active_masks,
const uint8_t* const src_lanes, const int width) {
if (deactivate_thread(active_masks)) {
return;
}
@@ -68,7 +68,7 @@ template <typename T> class WarpShfl : public WarpShflTest<WarpShfl<T>, T> {
const int src_offset = src_lane - rank_in_partition;
const auto mask_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[mask_idx]);
if (!active_mask.test(rank_in_warp) || (!active_mask.test((rank_in_warp + src_offset))) ||
@@ -31,9 +31,9 @@ THE SOFTWARE.
namespace cg = cooperative_groups;
template <typename T>
__global__ void shfl_down(T* const out, const T* const in, const uint64_t* const active_masks,
const unsigned int* const deltas, const int width) {
template <typename T> __global__ void shfl_down(T* const out, const T* const in,
const uint64_t* const active_masks,
const unsigned int* const deltas, const int width) {
if (deactivate_thread(active_masks)) {
return;
}
@@ -65,7 +65,7 @@ template <typename T> class WarpShflDown : public WarpShflTest<WarpShflDown<T>,
const auto rank_in_warp = rank_in_block % this->warp_size_;
const auto rank_in_partition = rank_in_block % width_;
const auto mask_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const unsigned int delta = deltas_[rank_in_partition] % width_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[mask_idx]);
@@ -31,9 +31,9 @@ THE SOFTWARE.
namespace cg = cooperative_groups;
template <typename T>
__global__ void shfl_up(T* const out, const T* const in, const uint64_t* const active_masks,
const unsigned int* const deltas, const int width) {
template <typename T> __global__ void shfl_up(T* const out, const T* const in,
const uint64_t* const active_masks,
const unsigned int* const deltas, const int width) {
if (deactivate_thread(active_masks)) {
return;
}
@@ -65,7 +65,7 @@ template <typename T> class WarpShflUp : public WarpShflTest<WarpShflUp<T>, T> {
const auto rank_in_warp = rank_in_block % this->warp_size_;
const auto rank_in_partition = rank_in_block % width_;
const auto mask_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const unsigned int delta = deltas_[rank_in_partition] % width_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[mask_idx]);
@@ -31,9 +31,9 @@ THE SOFTWARE.
namespace cg = cooperative_groups;
template <typename T>
__global__ void shfl_xor(T* const out, const T* const in, const uint64_t* const active_masks,
const int lane_mask, const int width) {
template <typename T> __global__ void shfl_xor(T* const out, const T* const in,
const uint64_t* const active_masks,
const int lane_mask, const int width) {
if (deactivate_thread(active_masks)) {
return;
}
@@ -61,7 +61,7 @@ template <typename T> class WarpShflXOR : public WarpShflTest<WarpShflXOR<T>, T>
const int warp_target = rank_in_warp ^ this->lane_mask_;
const int target_offset = warp_target - rank_in_warp;
const auto mask_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[mask_idx]);
const auto target_partition = warp_target / width_;