mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-02 04:31:25 +00:00
[rocm-libraries] ROCm/rocm-libraries#4797 (commit 1a30400)
[CK_TILE] Add CK Tile bwd weight profiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Motivation To compare old CK and CK Tile, we need to extend the current CK profiler to support running also CK Tile instance with the same API. In order to have the same instance coverage in CK Tile compared to the old CK, I've added code generation from old CK configurations to CK Tile instances using the CK Builder. ## Technical Details - The codegen python script for CK Tile fwd convs is extended to support also bwd weight and bwd data. - The generated instances are added to the CMake build (target `device_grouped_conv_bwd_weight_tile_instance`s). - A new profiler op (`grouped_conv_bwd_weight_tile`) has been added to the CK Profiler.
This commit is contained in:
committed by
assistant-librarian[bot]
parent
fc1e1a5155
commit
ae4e632c7d
89
experimental/grouped_convolution_tile_instances/configs/create_configs.sh
Executable file
89
experimental/grouped_convolution_tile_instances/configs/create_configs.sh
Executable file
@@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get flag --update-test-configs-only to skip running the CK profiler and update tests based on the existing profiler configs
|
||||
UPDATE_TEST_CONFIGS_ONLY=false
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" == "--update-test-configs-only" ]; then
|
||||
UPDATE_TEST_CONFIGS_ONLY=true
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$UPDATE_TEST_CONFIGS_ONLY" = false ]; then
|
||||
|
||||
ProfilerPath="../../../build/bin/ckProfiler"
|
||||
|
||||
# Layout: NHWGC-GKYXC-NHWGK (channels last)
|
||||
fwd_layout=1
|
||||
bwd_weight_layout=2
|
||||
bwd_data_layout=1
|
||||
|
||||
# FWD configs
|
||||
mkdir -p forward/profiler
|
||||
|
||||
# 2D
|
||||
dim=2
|
||||
$ProfilerPath grouped_conv_fwd 0 $fwd_layout $dim --instances > forward/profiler/nhwgc_fp32.conf
|
||||
$ProfilerPath grouped_conv_fwd 1 $fwd_layout $dim --instances > forward/profiler/nhwgc_fp16.conf
|
||||
$ProfilerPath grouped_conv_fwd 2 $fwd_layout $dim --instances > forward/profiler/nhwgc_bf16.conf
|
||||
|
||||
# 3D
|
||||
dim=3
|
||||
$ProfilerPath grouped_conv_fwd 2 $fwd_layout $dim --instances > forward/profiler/ndhwgc_bf16.conf
|
||||
$ProfilerPath grouped_conv_fwd 1 $fwd_layout $dim --instances > forward/profiler/ndhwgc_fp16.conf
|
||||
$ProfilerPath grouped_conv_fwd 0 $fwd_layout $dim --instances > forward/profiler/ndhwgc_fp32.conf
|
||||
|
||||
# BWD weight configs
|
||||
mkdir -p backward_weight/profiler
|
||||
|
||||
# 2D
|
||||
dim=2
|
||||
$ProfilerPath grouped_conv_bwd_weight 0 $bwd_weight_layout $dim --instances > backward_weight/profiler/nhwgc_fp32.conf
|
||||
$ProfilerPath grouped_conv_bwd_weight 1 $bwd_weight_layout $dim --instances > backward_weight/profiler/nhwgc_fp16.conf
|
||||
$ProfilerPath grouped_conv_bwd_weight 5 $bwd_weight_layout $dim --instances > backward_weight/profiler/nhwgc_bf16.conf
|
||||
|
||||
#3D
|
||||
dim=3
|
||||
$ProfilerPath grouped_conv_bwd_weight 5 $bwd_weight_layout $dim --instances > backward_weight/profiler/ndhwgc_bf16.conf
|
||||
$ProfilerPath grouped_conv_bwd_weight 1 $bwd_weight_layout $dim --instances > backward_weight/profiler/ndhwgc_fp16.conf
|
||||
$ProfilerPath grouped_conv_bwd_weight 0 $bwd_weight_layout $dim --instances > backward_weight/profiler/ndhwgc_fp32.conf
|
||||
|
||||
# BWD data configs
|
||||
mkdir -p backward_data/profiler
|
||||
|
||||
# 2D
|
||||
dim=2
|
||||
$ProfilerPath grouped_conv_bwd_data 0 $bwd_data_layout $dim --instances > backward_data/profiler/nhwgc_fp32.conf
|
||||
$ProfilerPath grouped_conv_bwd_data 1 $bwd_data_layout $dim --instances > backward_data/profiler/nhwgc_fp16.conf
|
||||
$ProfilerPath grouped_conv_bwd_data 2 $bwd_data_layout $dim --instances > backward_data/profiler/nhwgc_bf16.conf
|
||||
|
||||
#3D
|
||||
dim=3
|
||||
$ProfilerPath grouped_conv_bwd_data 2 $bwd_data_layout $dim --instances > backward_data/profiler/ndhwgc_bf16.conf
|
||||
$ProfilerPath grouped_conv_bwd_data 1 $bwd_data_layout $dim --instances > backward_data/profiler/ndhwgc_fp16.conf
|
||||
$ProfilerPath grouped_conv_bwd_data 0 $bwd_data_layout $dim --instances > backward_data/profiler/ndhwgc_fp32.conf
|
||||
|
||||
fi
|
||||
|
||||
mkdir -p forward/tests
|
||||
mkdir -p backward_weight/tests
|
||||
mkdir -p backward_data/tests
|
||||
|
||||
# Do not change the existing fwd test configs
|
||||
|
||||
# For BWD weight, generate new test configs by taking 20% of the profiler configs for each data type and layout
|
||||
for layout in nhwgc ndhwgc; do
|
||||
for dtype in fp32 fp16 bf16; do
|
||||
profiler_config="backward_weight/profiler/${layout}_${dtype}.conf"
|
||||
test_config="backward_weight/tests/${layout}_${dtype}.conf"
|
||||
awk 'NR % 5 == 0' $profiler_config > $test_config # 20% of lines in the profiler configs
|
||||
done
|
||||
done
|
||||
|
||||
# For BWD data, generate new test configs by taking 20% of the profiler configs for each data type and layout
|
||||
for layout in nhwgc ndhwgc; do
|
||||
for dtype in fp32 fp16 bf16; do
|
||||
profiler_config="backward_data/profiler/${layout}_${dtype}.conf"
|
||||
test_config="backward_data/tests/${layout}_${dtype}.conf"
|
||||
awk 'NR % 5 == 0' $profiler_config > $test_config # 20% of lines in the profiler configs
|
||||
done
|
||||
done
|
||||
Reference in New Issue
Block a user