mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-04-19 22:39:03 +00:00
[CK][EXAMPLES] (#2826)
-Added parameter to enable/disable verification and timing of kernel in various examples that missed it. -Added parameter to change number of groups to execute in grouped_gemm_examples. Signed-off-by: Michal Kulikowski <Michal.Kulikowski@amd.com>
This commit is contained in:
committed by
GitHub
parent
f3239395dc
commit
ffe9775e70
@@ -17,4 +17,23 @@ using DevicePermuteInstance = ck::tensor_operation::device::DevicePermuteImpl
|
||||
|
||||
#include "run_permute_element_example.inc"
|
||||
|
||||
int main() { return !run_permute_element_example({1, 32000, 80}, {0, 2, 1}); }
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
bool time_kernel = false;
|
||||
|
||||
if(argc == 1)
|
||||
{
|
||||
// use default
|
||||
}
|
||||
else if(argc == 2)
|
||||
{
|
||||
time_kernel = std::stoi(argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("arg1: time kernel (0=no, 1=yes, default=0)\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
return !run_permute_element_example({1, 32000, 80}, {0, 2, 1}, time_kernel);
|
||||
}
|
||||
|
||||
@@ -19,4 +19,23 @@ using DevicePermuteInstance = ck::tensor_operation::device::DevicePermuteImpl
|
||||
|
||||
#include "run_permute_bundle_example.inc"
|
||||
|
||||
int main() { return !run_permute_bundle_example({1, 80, 32000}, {0, 2, 1}); }
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
bool time_kernel = false;
|
||||
|
||||
if(argc == 1)
|
||||
{
|
||||
// use default
|
||||
}
|
||||
else if(argc == 2)
|
||||
{
|
||||
time_kernel = std::stoi(argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("arg1: time kernel (0=no, 1=yes, default=0)\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
return !run_permute_bundle_example({1, 80, 32000}, {0, 2, 1}, time_kernel);
|
||||
}
|
||||
|
||||
@@ -17,4 +17,23 @@ using DevicePermuteInstance = ck::tensor_operation::device::DevicePermuteImpl
|
||||
|
||||
#include "run_permute_element_example.inc"
|
||||
|
||||
int main() { return !run_permute_element_example({121, 768, 80}, {0, 2, 1}); }
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
bool time_kernel = false;
|
||||
|
||||
if(argc == 1)
|
||||
{
|
||||
// use default
|
||||
}
|
||||
else if(argc == 2)
|
||||
{
|
||||
time_kernel = std::stoi(argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("arg1: time kernel (0=no, 1=yes, default=0)\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
return !run_permute_element_example({121, 768, 80}, {0, 2, 1}, time_kernel);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
bool run_permute_bundle(const Problem& problem)
|
||||
bool run_permute_bundle(const Problem& problem, bool time_kernel)
|
||||
{
|
||||
const auto& input_bundle_shape = problem.shape;
|
||||
const auto& input_bundle_axes = problem.axes;
|
||||
@@ -41,7 +41,7 @@ bool run_permute_bundle(const Problem& problem)
|
||||
};
|
||||
|
||||
auto invoker = permute.MakeInvoker();
|
||||
float ave_time = invoker.Run(argument, StreamConfig{nullptr, true});
|
||||
float ave_time = invoker.Run(argument, StreamConfig{nullptr, time_kernel});
|
||||
|
||||
std::cout << "Perf: " << ave_time << " ms" << std::endl;
|
||||
|
||||
@@ -72,7 +72,9 @@ bool run_permute_bundle(const Problem& problem)
|
||||
1e-6);
|
||||
}
|
||||
|
||||
bool run_permute_bundle_example(const Problem::Shape& shape, const Problem::Axes& axes)
|
||||
bool run_permute_bundle_example(const Problem::Shape& shape,
|
||||
const Problem::Axes& axes,
|
||||
bool time_kernel)
|
||||
{
|
||||
return run_permute_bundle(Problem{shape, axes});
|
||||
return run_permute_bundle(Problem{shape, axes}, time_kernel);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
bool run_permute_element(const Problem& problem)
|
||||
bool run_permute_element(const Problem& problem, bool time_kernel)
|
||||
{
|
||||
const auto& input_shape = problem.shape;
|
||||
const auto& input_axes = problem.axes;
|
||||
@@ -40,7 +40,7 @@ bool run_permute_element(const Problem& problem)
|
||||
};
|
||||
|
||||
auto invoker = permute.MakeInvoker();
|
||||
float ave_time = invoker.Run(argument, StreamConfig{nullptr, true});
|
||||
float ave_time = invoker.Run(argument, StreamConfig{nullptr, time_kernel});
|
||||
|
||||
std::cout << "Perf: " << ave_time << " ms" << std::endl;
|
||||
|
||||
@@ -59,7 +59,9 @@ bool run_permute_element(const Problem& problem)
|
||||
1e-6);
|
||||
}
|
||||
|
||||
bool run_permute_element_example(const Problem::Shape& shape, const Problem::Axes& axes)
|
||||
bool run_permute_element_example(const Problem::Shape& shape,
|
||||
const Problem::Axes& axes,
|
||||
bool time_kernel)
|
||||
{
|
||||
return run_permute_element(Problem{shape, axes});
|
||||
return run_permute_element(Problem{shape, axes}, time_kernel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user