diff --git a/.azuredevops/rocm-ci.yml b/.azuredevops/rocm-ci.yml index 51dddb9cc..3c0d1b7df 100644 --- a/.azuredevops/rocm-ci.yml +++ b/.azuredevops/rocm-ci.yml @@ -13,6 +13,7 @@ trigger: batch: true branches: include: + - develop - amd-staging - amd-mainline paths: @@ -29,6 +30,7 @@ pr: autoCancel: true branches: include: + - develop - amd-staging - amd-mainline paths: diff --git a/CHANGELOG.md b/CHANGELOG.md index 097d9b911..ed301db73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Full documentation for ROCm Compute Profiler is available at [https://rocm.docs.amd.com/projects/rocprofiler-compute/en/latest/](https://rocm.docs.amd.com/projects/rocprofiler-compute/en/latest/). +## Unreleased + +* Add Docker files to package the application and dependencies into a single portable and executable standalone binary file + ## (Unreleased) ROCm Compute Profiler 3.1.0 for ROCm 6.4.0 ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index 40d00c713..5192747e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -372,6 +372,30 @@ add_custom_target( "src/${PACKAGE_NAME},cmake/Dockerfile,cmake/rocm_install.sh,docker/docker-entrypoint.sh,src/rocprof_compute_analyze/convertor/mongodb/convert" ) +# Standalone binary creation +add_custom_target( + standalonebinary + # Change working directory to src + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src + # Check nuitka + COMMAND ${Python3_EXECUTABLE} -m pip list | grep -i nuitka > /dev/null 2>&1 + # Check patchelf + COMMAND ${Python3_EXECUTABLE} -m pip list | grep -i patchelf > /dev/null 2>&1 + # Create VERSION.sha file + COMMAND git -C ${PROJECT_SOURCE_DIR} rev-parse HEAD > VERSION.sha + # Build standalone binary + COMMAND + ${Python3_EXECUTABLE} -m nuitka --mode=onefile + --include-data-files=${PROJECT_SOURCE_DIR}/VERSION*=./ --enable-plugin=no-qt + --include-package-data=dash_svg --include-package=dash_bootstrap_components + --include-package=plotly --include-package-data=kaleido + --include-package=rocprof_compute_soc --include-package-data=rocprof_compute_soc + --include-package-data=utils rocprof-compute + # Remove library rpath from executable + COMMAND patchelf --remove-rpath rocprof-compute.bin + # Move to build directory + COMMAND mv rocprof-compute.bin ${CMAKE_BINARY_DIR}) + install( FILES ${PROJECT_SOURCE_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR} diff --git a/LICENSE b/LICENSE index cf05f5a56..fc143f666 100644 --- a/LICENSE +++ b/LICENSE @@ -19,3 +19,22 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +This application uses the following dependencies and their usage is governed by their respective licenses +Python 3 standard library: PSFL +Nuitka specific runtime code: Apache 2.0 license +astunparse python library: PSFL +colorlover python library: MIT +dash python library: MIT +matplotlib python library: PSFL +numpy python library: BSD +pandas python library: BSD +pymongo python library: Apache 2.0 license +pyyaml python library: MIT +tabulate python library: MIT +tqdm python library: MIT +dash-svg python library: MIT +dash-bootstrap-components python library: MIT +kaleido python library: MIT +setuptools python library: MIT +plotille python library: MIT \ No newline at end of file diff --git a/README.md b/README.md index a95bb3e36..d2b8ebf18 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ Users may checkout `amd-staging` to preview upcoming features. ## Testing To quickly get the environment (bash shell) for building and testing, run the following commands: -* `cd utils/docker_env` -* `docker compose run app` +* `cd docker` +* `docker compose -f docker-compose.test.yml run test` Inside the docker container, clean, build and install the project with tests enabled: ``` @@ -56,6 +56,27 @@ For manual testing, you can find the executable at `install/bin/rocprof-compute` NOTE: This Dockerfile uses `rocm/dev-ubuntu-22.04` as the base image +## Standalone binary + +To create a standalone binary, run the following commands: +* `cd docker` +* `docker compose -f docker-compose.standalone.yml run standalone` + +You should find the rocprof-compute.bin standalone binary inside the `build` folder in the root directory of the project. + +To build the binary we follow these steps: +* Use RHEL 8 image used to build ROCm as the base image +* Install python3.8 +* Install dependencies for runtime and for making standalone binary +* Call the make target which uses Nuitka to build the standalone binary + +NOTE: Since RHEL 8 ships with glibc version 2.28, this standalone binary can only be run on environment with glibc version greater than 2.28. +glibc version can be checked using `ldd --version` command. + +NOTE: libnss3.so shared library is required when using --roof-only option which generates roofline data in PDF format + +To test the standalone binary provide the `--call-binary` option to pytest. + ## How to Cite This software can be cited using a Zenodo diff --git a/docker/Dockerfile.standalone b/docker/Dockerfile.standalone new file mode 100644 index 000000000..4f32c01d8 --- /dev/null +++ b/docker/Dockerfile.standalone @@ -0,0 +1,22 @@ +FROM redhat/ubi8:8.10-1184 + +WORKDIR /app + +RUN yum install -y curl gcc cmake git + +# Allows running git commands in /app +RUN git config --global --add safe.directory /app + +RUN yum install -y python38 python38-devel && \ + yum clean all && \ + rm -rf /var/cache/yum && \ + curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ + python3.8 get-pip.py + +CMD ["/bin/bash", "-c", "\ + python3.8 -m pip install -r requirements.txt \ + && python3.8 -m pip install nuitka patchelf \ + && rm -rf build \ + && cmake -B build -S . \ + && make -C build standalonebinary \ +"] \ No newline at end of file diff --git a/utils/docker_env/Dockerfile b/docker/Dockerfile.test similarity index 66% rename from utils/docker_env/Dockerfile rename to docker/Dockerfile.test index 19c91b4fd..e08407cbb 100644 --- a/utils/docker_env/Dockerfile +++ b/docker/Dockerfile.test @@ -6,10 +6,13 @@ WORKDIR /app # Update package list and install prerequisites RUN apt-get update && apt-get install -y \ - software-properties-common cmake locales \ + software-properties-common cmake locales git \ && add-apt-repository ppa:deadsnakes/ppa \ && apt-get update +# Allows running git commands in /app +RUN git config --global --add safe.directory /app + # Generate the desired locale RUN locale-gen en_US.UTF-8 @@ -19,11 +22,9 @@ RUN apt-get install -y python3.10 python3.10-venv python3.10-dev python3-pip # Set Python 3.10 as the default python3 RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 -# Copy your application code to the container -COPY . . - # Install any dependencies specified in requirements.txt -RUN pip3 install --no-cache-dir -r requirements.txt -r requirements-test.txt - -# Command to run your application -CMD ["/bin/bash"] \ No newline at end of file +# Run interactive bash shell +CMD ["/bin/bash", "-c", "\ + python3.10 -m pip install -r requirements.txt -r requirements-test.txt \ + && exec /bin/bash \ +"] \ No newline at end of file diff --git a/docker/docker-compose.standalone.yml b/docker/docker-compose.standalone.yml new file mode 100644 index 000000000..4df255736 --- /dev/null +++ b/docker/docker-compose.standalone.yml @@ -0,0 +1,12 @@ +services: + standalone: + build: + context: ../ + dockerfile: docker/Dockerfile.standalone + devices: + - /dev/kfd + - /dev/dri + security_opt: + - seccomp:unconfined + volumes: + - ../:/app \ No newline at end of file diff --git a/docker/docker-compose.test.yml b/docker/docker-compose.test.yml new file mode 100644 index 000000000..cb20c5fdb --- /dev/null +++ b/docker/docker-compose.test.yml @@ -0,0 +1,12 @@ +services: + test: + build: + context: ../ + dockerfile: docker/Dockerfile.test + devices: + - /dev/kfd + - /dev/dri + security_opt: + - seccomp:unconfined + volumes: + - ../:/app \ No newline at end of file diff --git a/src/rocprof_compute_profile/profiler_base.py b/src/rocprof_compute_profile/profiler_base.py index 14e0e4a59..d60340252 100644 --- a/src/rocprof_compute_profile/profiler_base.py +++ b/src/rocprof_compute_profile/profiler_base.py @@ -26,6 +26,7 @@ import logging import os import re +import shutil import sys import time from abc import ABC, abstractmethod @@ -77,6 +78,26 @@ def join_prof(self, out=None): out = self.__args.path + "/pmc_perf.csv" files = glob.glob(self.__args.path + "/" + "pmc_perf_*.csv") files.extend(glob.glob(self.__args.path + "/" + "SQ_*.csv")) + + if self.get_args().hip_trace: + # remove hip api trace ouputs from this list + files = [ + f + for f in files + if not re.compile(r"^.*_hip_api_trace\.csv$").match( + os.path.basename(f) + ) + ] + + if self.get_args().kokkos_trace: + # remove marker api trace ouputs from this list + files = [ + f + for f in files + if not re.compile(r"^.*_marker_api_trace\.csv$").match( + os.path.basename(f) + ) + ] elif type(self.__args.path) == list: files = self.__args.path else: @@ -266,7 +287,8 @@ def pre_processing(self): # verify correct formatting for application binary self.__args.remaining = self.__args.remaining[1:] if self.__args.remaining: - if not Path(self.__args.remaining[0]).is_file(): + # Ensure that command points to an executable + if not shutil.which(self.__args.remaining[0]): console_error( "Your command %s doesn't point to a executable. Please verify." % self.__args.remaining[0] diff --git a/src/rocprof_compute_soc/analysis_configs/gfx906/0200_system-speed-of-light.yaml b/src/rocprof_compute_soc/analysis_configs/gfx906/0200_system-speed-of-light.yaml index c3700c598..3ab7a6b9d 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx906/0200_system-speed-of-light.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx906/0200_system-speed-of-light.yaml @@ -32,6 +32,12 @@ Panel Config: peak: (((($max_sclk * $cu_per_gpu) * 64) * 2) / 1000) pop: None # No perf counter tips: + MFMA FLOPs (F8): + value: None # No HW module + unit: GFLOP + peak: None # No HW module + pop: None # No HW module + tips: MFMA FLOPs (BF16): value: None # No perf counter unit: GFLOPs diff --git a/src/rocprof_compute_soc/analysis_configs/gfx906/1000_compute-unit-instruction-mix.yaml b/src/rocprof_compute_soc/analysis_configs/gfx906/1000_compute-unit-instruction-mix.yaml index d3a7e8944..808c505d6 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx906/1000_compute-unit-instruction-mix.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx906/1000_compute-unit-instruction-mix.yaml @@ -241,6 +241,12 @@ Panel Config: max: None # No HW module unit: (instr + $normUnit) tips: + MFMA-F8: + avg: None # No HW module + min: None # No HW module + max: None # No HW module None # No HW module + unit: (instr + $normUnit) + tips: MFMA-F16: avg: None # No HW module min: None # No HW module diff --git a/src/rocprof_compute_soc/analysis_configs/gfx906/1100_compute-unit-compute-pipeline.yaml b/src/rocprof_compute_soc/analysis_configs/gfx906/1100_compute-unit-compute-pipeline.yaml index 5296f403e..81b232f03 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx906/1100_compute-unit-compute-pipeline.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx906/1100_compute-unit-compute-pipeline.yaml @@ -21,16 +21,22 @@ Panel Config: metric: VALU FLOPs: value: None # No perf counter - Unit: None + unit: None peak: None pop: None tips: VALU IOPs: value: None # No perf counter - Unit: None + unit: None peak: None pop: None tips: + MFMA FLOPs (F8): + value: None # No perf counter + unit: GFLOP + peak: None # No perf counter + pop: None # No perf counter + tips: MFMA FLOPs (BF16): value: None # No perf counter Unit: None @@ -39,25 +45,25 @@ Panel Config: tips: MFMA FLOPs (F16): value: None # No perf counter - Unit: None + unit: None peak: None pop: None tips: MFMA FLOPs (F32): value: None # No perf counter - Unit: None + unit: None peak: None pop: None tips: MFMA FLOPs (F64): value: None # No perf counter - Unit: None + unit: None peak: None pop: None tips: MFMA IOPs (INT8): value: None # No perf counter - Unit: None + unit: None peak: None pop: None tips: @@ -174,6 +180,12 @@ Panel Config: max: None # No perf counter unit: (OPs + $normUnit) tips: + F8 OPs: + avg: None # No HW module + min: None # No HW module + max: None # No HW module + unit: (OPs + $normUnit) + tips: F16 OPs: avg: None # No perf counter min: None # No perf counter diff --git a/src/rocprof_compute_soc/analysis_configs/gfx908/0200_system-speed-of-light.yaml b/src/rocprof_compute_soc/analysis_configs/gfx908/0200_system-speed-of-light.yaml index 9849670ed..8e52572ff 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx908/0200_system-speed-of-light.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx908/0200_system-speed-of-light.yaml @@ -32,6 +32,12 @@ Panel Config: peak: (((($max_sclk * $cu_per_gpu) * 64) * 2) / 1000) pop: None # No perf counter tips: + MFMA FLOPs (F8): + value: None # No HW module + unit: GFLOP + peak: None # No HW module + pop: None # No HW module + tips: MFMA FLOPs (BF16): value: None # No perf counter unit: GFLOPs diff --git a/src/rocprof_compute_soc/analysis_configs/gfx908/1000_compute-unit-instruction-mix.yaml b/src/rocprof_compute_soc/analysis_configs/gfx908/1000_compute-unit-instruction-mix.yaml index cd2446612..91ccbb9e5 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx908/1000_compute-unit-instruction-mix.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx908/1000_compute-unit-instruction-mix.yaml @@ -73,13 +73,13 @@ Panel Config: unit: Unit tips: Tips metric: - INT-32: + INT32: avg: None # No perf counter min: None # No perf counter max: None # No perf counter unit: (instr + $normUnit) tips: - INT-64: + INT64: avg: None # No perf counter min: None # No perf counter max: None # No perf counter @@ -241,6 +241,12 @@ Panel Config: max: None # No HW module unit: (instr + $normUnit) tips: + MFMA-F8: + avg: None # No HW module + min: None # No HW module + max: None # No HW module None # No HW module + unit: (instr + $normUnit) + tips: MFMA-F16: avg: None # No HW module min: None # No HW module diff --git a/src/rocprof_compute_soc/analysis_configs/gfx908/1100_compute-unit-compute-pipeline.yaml b/src/rocprof_compute_soc/analysis_configs/gfx908/1100_compute-unit-compute-pipeline.yaml index 5296f403e..81b232f03 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx908/1100_compute-unit-compute-pipeline.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx908/1100_compute-unit-compute-pipeline.yaml @@ -21,16 +21,22 @@ Panel Config: metric: VALU FLOPs: value: None # No perf counter - Unit: None + unit: None peak: None pop: None tips: VALU IOPs: value: None # No perf counter - Unit: None + unit: None peak: None pop: None tips: + MFMA FLOPs (F8): + value: None # No perf counter + unit: GFLOP + peak: None # No perf counter + pop: None # No perf counter + tips: MFMA FLOPs (BF16): value: None # No perf counter Unit: None @@ -39,25 +45,25 @@ Panel Config: tips: MFMA FLOPs (F16): value: None # No perf counter - Unit: None + unit: None peak: None pop: None tips: MFMA FLOPs (F32): value: None # No perf counter - Unit: None + unit: None peak: None pop: None tips: MFMA FLOPs (F64): value: None # No perf counter - Unit: None + unit: None peak: None pop: None tips: MFMA IOPs (INT8): value: None # No perf counter - Unit: None + unit: None peak: None pop: None tips: @@ -174,6 +180,12 @@ Panel Config: max: None # No perf counter unit: (OPs + $normUnit) tips: + F8 OPs: + avg: None # No HW module + min: None # No HW module + max: None # No HW module + unit: (OPs + $normUnit) + tips: F16 OPs: avg: None # No perf counter min: None # No perf counter diff --git a/src/rocprof_compute_soc/analysis_configs/gfx90a/0200_system-speed-of-light.yaml b/src/rocprof_compute_soc/analysis_configs/gfx90a/0200_system-speed-of-light.yaml index df4667542..583ce554e 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx90a/0200_system-speed-of-light.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx90a/0200_system-speed-of-light.yaml @@ -42,6 +42,12 @@ Panel Config: pop: ((100 * AVG(((64 * (SQ_INSTS_VALU_INT32 + SQ_INSTS_VALU_INT64)) / (End_Timestamp - Start_Timestamp)))) / (((($max_sclk * $cu_per_gpu) * 64) * 2) / 1000)) tips: + MFMA FLOPs (F8): + value: None + unit: GFLOP + peak: None + pop: None + tips: MFMA FLOPs (BF16): value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_BF16 * 512) / (End_Timestamp - Start_Timestamp))) unit: GFLOP diff --git a/src/rocprof_compute_soc/analysis_configs/gfx90a/1000_compute-unit-instruction-mix.yaml b/src/rocprof_compute_soc/analysis_configs/gfx90a/1000_compute-unit-instruction-mix.yaml index 045f217ad..b1079479f 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx90a/1000_compute-unit-instruction-mix.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx90a/1000_compute-unit-instruction-mix.yaml @@ -241,6 +241,12 @@ Panel Config: max: MAX((SQ_INSTS_VALU_MFMA_I8 / $denom)) unit: (instr + $normUnit) tips: + MFMA-F8: + avg: None + min: None + max: None + unit: (instr + $normUnit) + tips: MFMA-F16: avg: AVG((SQ_INSTS_VALU_MFMA_F16 / $denom)) min: MIN((SQ_INSTS_VALU_MFMA_F16 / $denom)) diff --git a/src/rocprof_compute_soc/analysis_configs/gfx90a/1100_compute-unit-compute-pipeline.yaml b/src/rocprof_compute_soc/analysis_configs/gfx90a/1100_compute-unit-compute-pipeline.yaml index c54a6703e..f0a13d44a 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx90a/1100_compute-unit-compute-pipeline.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx90a/1100_compute-unit-compute-pipeline.yaml @@ -41,6 +41,12 @@ Panel Config: pop: ((100 * AVG(((64 * (SQ_INSTS_VALU_INT32 + SQ_INSTS_VALU_INT64)) / (End_Timestamp - Start_Timestamp)))) / (((($max_sclk * $cu_per_gpu) * 64) * 2) / 1000)) tips: + MFMA FLOPs (F8): + value: None + unit: GFLOP + peak: None + pop: None + tips: MFMA FLOPs (BF16): value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_BF16 * 512) / (End_Timestamp - Start_Timestamp))) unit: GFLOP @@ -216,6 +222,12 @@ Panel Config: max: MAX(((64 * (SQ_INSTS_VALU_INT32 + SQ_INSTS_VALU_INT64)) + (SQ_INSTS_VALU_MFMA_MOPS_I8 * 512)) / $denom) unit: (OPs + $normUnit) tips: + F8 OPs: + avg: None + min: None + max: None + unit: (OPs + $normUnit) + tips: F16 OPs: avg: AVG(((((((64 * SQ_INSTS_VALU_ADD_F16) + (64 * SQ_INSTS_VALU_MUL_F16)) + (64 * SQ_INSTS_VALU_TRANS_F16)) + (128 * SQ_INSTS_VALU_FMA_F16)) + (512 * diff --git a/src/rocprof_compute_soc/analysis_configs/gfx940/0200_system-speed-of-light.yaml b/src/rocprof_compute_soc/analysis_configs/gfx940/0200_system-speed-of-light.yaml index ca2d5d055..b0a7399e5 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx940/0200_system-speed-of-light.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx940/0200_system-speed-of-light.yaml @@ -42,6 +42,13 @@ Panel Config: pop: ((100 * AVG(((64 * (SQ_INSTS_VALU_INT32 + SQ_INSTS_VALU_INT64)) / (End_Timestamp - Start_Timestamp)))) / (((($max_sclk * $cu_per_gpu) * 64) * 2) / 1000)) tips: + MFMA FLOPs (F8): + value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_F8 * 512) / (End_Timestamp - Start_Timestamp))) + unit: GFLOP + peak: ((($max_sclk * $cu_per_gpu) * 4096) / 1000) + pop: ((100 * AVG(((SQ_INSTS_VALU_MFMA_MOPS_F8 * 512) / (End_Timestamp - Start_Timestamp)))) + / ((($max_sclk * $cu_per_gpu) * 8192) / 1000)) + tips: MFMA FLOPs (BF16): value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_BF16 * 512) / (End_Timestamp - Start_Timestamp))) unit: GFLOP @@ -187,12 +194,14 @@ Panel Config: / ((($max_sclk / 1000) * 128) * TO_INT($total_l2_chan))) tips: L2-Fabric Read BW: - value: AVG((((TCC_EA0_RDREQ_32B_sum * 32) + ((TCC_EA0_RDREQ_sum - TCC_EA0_RDREQ_32B_sum) - * 64)) / (End_Timestamp - Start_Timestamp))) + value: AVG((128 * TCC_BUBBLE_sum + + 64 * (TCC_EA0_RDREQ_sum - TCC_BUBBLE_sum - TCC_EA0_RDREQ_32B_sum) + + 32 * TCC_EA0_RDREQ_32B_sum) / (End_Timestamp - Start_Timestamp)) unit: GB/s peak: $hbm_bw - pop: ((100 * AVG((((TCC_EA0_RDREQ_32B_sum * 32) + ((TCC_EA0_RDREQ_sum - TCC_EA0_RDREQ_32B_sum) - * 64)) / (End_Timestamp - Start_Timestamp)))) / $hbm_bw) + pop: ((100 * (AVG((128 * TCC_BUBBLE_sum + + 64 * (TCC_EA0_RDREQ_sum - TCC_BUBBLE_sum - TCC_EA0_RDREQ_32B_sum) + + 32 * TCC_EA0_RDREQ_32B_sum) / (End_Timestamp - Start_Timestamp)))) / $hbm_bw) tips: L2-Fabric Write BW: value: AVG((((TCC_EA0_WRREQ_64B_sum * 64) + ((TCC_EA0_WRREQ_sum - TCC_EA0_WRREQ_64B_sum) diff --git a/src/rocprof_compute_soc/analysis_configs/gfx940/1000_compute-unit-instruction-mix.yaml b/src/rocprof_compute_soc/analysis_configs/gfx940/1000_compute-unit-instruction-mix.yaml index f49732e79..83ba5367a 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx940/1000_compute-unit-instruction-mix.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx940/1000_compute-unit-instruction-mix.yaml @@ -245,6 +245,12 @@ Panel Config: max: MAX((SQ_INSTS_VALU_MFMA_I8 / $denom)) unit: (instr + $normUnit) tips: + MFMA-F8: + avg: AVG((SQ_INSTS_VALU_MFMA_F8 / $denom)) + min: MIN((SQ_INSTS_VALU_MFMA_F8 / $denom)) + max: MAX((SQ_INSTS_VALU_MFMA_F8 / $denom)) + unit: (instr + $normUnit) + tips: MFMA-F16: avg: AVG((SQ_INSTS_VALU_MFMA_F16 / $denom)) min: MIN((SQ_INSTS_VALU_MFMA_F16 / $denom)) diff --git a/src/rocprof_compute_soc/analysis_configs/gfx940/1100_compute-unit-compute-pipeline.yaml b/src/rocprof_compute_soc/analysis_configs/gfx940/1100_compute-unit-compute-pipeline.yaml index a4465ebed..932d9cb5d 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx940/1100_compute-unit-compute-pipeline.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx940/1100_compute-unit-compute-pipeline.yaml @@ -41,6 +41,13 @@ Panel Config: pop: ((100 * AVG(((64 * (SQ_INSTS_VALU_INT32 + SQ_INSTS_VALU_INT64)) / (End_Timestamp - Start_Timestamp)))) / (((($max_sclk * $cu_per_gpu) * 64) * 2) / 1000)) tips: + MFMA FLOPs (F8): + value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_F8 * 512) / (End_Timestamp - Start_Timestamp))) + unit: GFLOP + peak: ((($max_sclk * $cu_per_gpu) * 8192) / 1000) + pop: ((100 * AVG(((SQ_INSTS_VALU_MFMA_MOPS_F8 * 512) / (End_Timestamp - Start_Timestamp)))) + / ((($max_sclk * $cu_per_gpu) * 8192) / 1000)) + tips: MFMA FLOPs (BF16): value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_BF16 * 512) / (End_Timestamp - Start_Timestamp))) unit: GFLOP @@ -188,21 +195,21 @@ Panel Config: metric: FLOPs (Total): avg: AVG((((((((64 * (((SQ_INSTS_VALU_ADD_F16 + SQ_INSTS_VALU_MUL_F16) + SQ_INSTS_VALU_TRANS_F16) - + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 + + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 * SQ_INSTS_VALU_MFMA_MOPS_BF16))) + (64 * (((SQ_INSTS_VALU_ADD_F32 + SQ_INSTS_VALU_MUL_F32) + SQ_INSTS_VALU_TRANS_F32) + (SQ_INSTS_VALU_FMA_F32 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F32)) + (64 * (((SQ_INSTS_VALU_ADD_F64 + SQ_INSTS_VALU_MUL_F64) + SQ_INSTS_VALU_TRANS_F64) + (SQ_INSTS_VALU_FMA_F64 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F64)) / $denom)) min: MIN((((((((64 * (((SQ_INSTS_VALU_ADD_F16 + SQ_INSTS_VALU_MUL_F16) + SQ_INSTS_VALU_TRANS_F16) - + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 + + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 * SQ_INSTS_VALU_MFMA_MOPS_BF16))) + (64 * (((SQ_INSTS_VALU_ADD_F32 + SQ_INSTS_VALU_MUL_F32) + SQ_INSTS_VALU_TRANS_F32) + (SQ_INSTS_VALU_FMA_F32 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F32)) + (64 * (((SQ_INSTS_VALU_ADD_F64 + SQ_INSTS_VALU_MUL_F64) + SQ_INSTS_VALU_TRANS_F64) + (SQ_INSTS_VALU_FMA_F64 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F64)) / $denom)) max: MAX((((((((64 * (((SQ_INSTS_VALU_ADD_F16 + SQ_INSTS_VALU_MUL_F16) + SQ_INSTS_VALU_TRANS_F16) - + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 + + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 * SQ_INSTS_VALU_MFMA_MOPS_BF16))) + (64 * (((SQ_INSTS_VALU_ADD_F32 + SQ_INSTS_VALU_MUL_F32) + SQ_INSTS_VALU_TRANS_F32) + (SQ_INSTS_VALU_FMA_F32 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F32)) + (64 * (((SQ_INSTS_VALU_ADD_F64 + SQ_INSTS_VALU_MUL_F64) + SQ_INSTS_VALU_TRANS_F64) @@ -216,6 +223,12 @@ Panel Config: max: MAX(((64 * (SQ_INSTS_VALU_INT32 + SQ_INSTS_VALU_INT64)) + (SQ_INSTS_VALU_MFMA_MOPS_I8 * 512)) / $denom) unit: (OPs + $normUnit) tips: + F8 OPs: + avg: AVG(((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) / $denom)) + min: MIN(((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) / $denom)) + max: MAX(((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) / $denom)) + unit: (OPs + $normUnit) + tips: F16 OPs: avg: AVG(((((((64 * SQ_INSTS_VALU_ADD_F16) + (64 * SQ_INSTS_VALU_MUL_F16)) + (64 * SQ_INSTS_VALU_TRANS_F16)) + (128 * SQ_INSTS_VALU_FMA_F16)) + (512 * diff --git a/src/rocprof_compute_soc/analysis_configs/gfx940/1700_L2_cache.yaml b/src/rocprof_compute_soc/analysis_configs/gfx940/1700_L2_cache.yaml index aaa45b963..fc2104a47 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx940/1700_L2_cache.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx940/1700_L2_cache.yaml @@ -432,4 +432,4 @@ Panel Config: min: MIN((TCC_EA0_ATOMIC_sum / $denom)) max: MAX((TCC_EA0_ATOMIC_sum / $denom)) unit: (Req + $normUnit) - tips: + tips: \ No newline at end of file diff --git a/src/rocprof_compute_soc/analysis_configs/gfx941/0200_system-speed-of-light.yaml b/src/rocprof_compute_soc/analysis_configs/gfx941/0200_system-speed-of-light.yaml index ca2d5d055..b0a7399e5 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx941/0200_system-speed-of-light.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx941/0200_system-speed-of-light.yaml @@ -42,6 +42,13 @@ Panel Config: pop: ((100 * AVG(((64 * (SQ_INSTS_VALU_INT32 + SQ_INSTS_VALU_INT64)) / (End_Timestamp - Start_Timestamp)))) / (((($max_sclk * $cu_per_gpu) * 64) * 2) / 1000)) tips: + MFMA FLOPs (F8): + value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_F8 * 512) / (End_Timestamp - Start_Timestamp))) + unit: GFLOP + peak: ((($max_sclk * $cu_per_gpu) * 4096) / 1000) + pop: ((100 * AVG(((SQ_INSTS_VALU_MFMA_MOPS_F8 * 512) / (End_Timestamp - Start_Timestamp)))) + / ((($max_sclk * $cu_per_gpu) * 8192) / 1000)) + tips: MFMA FLOPs (BF16): value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_BF16 * 512) / (End_Timestamp - Start_Timestamp))) unit: GFLOP @@ -187,12 +194,14 @@ Panel Config: / ((($max_sclk / 1000) * 128) * TO_INT($total_l2_chan))) tips: L2-Fabric Read BW: - value: AVG((((TCC_EA0_RDREQ_32B_sum * 32) + ((TCC_EA0_RDREQ_sum - TCC_EA0_RDREQ_32B_sum) - * 64)) / (End_Timestamp - Start_Timestamp))) + value: AVG((128 * TCC_BUBBLE_sum + + 64 * (TCC_EA0_RDREQ_sum - TCC_BUBBLE_sum - TCC_EA0_RDREQ_32B_sum) + + 32 * TCC_EA0_RDREQ_32B_sum) / (End_Timestamp - Start_Timestamp)) unit: GB/s peak: $hbm_bw - pop: ((100 * AVG((((TCC_EA0_RDREQ_32B_sum * 32) + ((TCC_EA0_RDREQ_sum - TCC_EA0_RDREQ_32B_sum) - * 64)) / (End_Timestamp - Start_Timestamp)))) / $hbm_bw) + pop: ((100 * (AVG((128 * TCC_BUBBLE_sum + + 64 * (TCC_EA0_RDREQ_sum - TCC_BUBBLE_sum - TCC_EA0_RDREQ_32B_sum) + + 32 * TCC_EA0_RDREQ_32B_sum) / (End_Timestamp - Start_Timestamp)))) / $hbm_bw) tips: L2-Fabric Write BW: value: AVG((((TCC_EA0_WRREQ_64B_sum * 64) + ((TCC_EA0_WRREQ_sum - TCC_EA0_WRREQ_64B_sum) diff --git a/src/rocprof_compute_soc/analysis_configs/gfx941/1000_compute-unit-instruction-mix.yaml b/src/rocprof_compute_soc/analysis_configs/gfx941/1000_compute-unit-instruction-mix.yaml index f49732e79..83ba5367a 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx941/1000_compute-unit-instruction-mix.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx941/1000_compute-unit-instruction-mix.yaml @@ -245,6 +245,12 @@ Panel Config: max: MAX((SQ_INSTS_VALU_MFMA_I8 / $denom)) unit: (instr + $normUnit) tips: + MFMA-F8: + avg: AVG((SQ_INSTS_VALU_MFMA_F8 / $denom)) + min: MIN((SQ_INSTS_VALU_MFMA_F8 / $denom)) + max: MAX((SQ_INSTS_VALU_MFMA_F8 / $denom)) + unit: (instr + $normUnit) + tips: MFMA-F16: avg: AVG((SQ_INSTS_VALU_MFMA_F16 / $denom)) min: MIN((SQ_INSTS_VALU_MFMA_F16 / $denom)) diff --git a/src/rocprof_compute_soc/analysis_configs/gfx941/1100_compute-unit-compute-pipeline.yaml b/src/rocprof_compute_soc/analysis_configs/gfx941/1100_compute-unit-compute-pipeline.yaml index a4465ebed..932d9cb5d 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx941/1100_compute-unit-compute-pipeline.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx941/1100_compute-unit-compute-pipeline.yaml @@ -41,6 +41,13 @@ Panel Config: pop: ((100 * AVG(((64 * (SQ_INSTS_VALU_INT32 + SQ_INSTS_VALU_INT64)) / (End_Timestamp - Start_Timestamp)))) / (((($max_sclk * $cu_per_gpu) * 64) * 2) / 1000)) tips: + MFMA FLOPs (F8): + value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_F8 * 512) / (End_Timestamp - Start_Timestamp))) + unit: GFLOP + peak: ((($max_sclk * $cu_per_gpu) * 8192) / 1000) + pop: ((100 * AVG(((SQ_INSTS_VALU_MFMA_MOPS_F8 * 512) / (End_Timestamp - Start_Timestamp)))) + / ((($max_sclk * $cu_per_gpu) * 8192) / 1000)) + tips: MFMA FLOPs (BF16): value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_BF16 * 512) / (End_Timestamp - Start_Timestamp))) unit: GFLOP @@ -188,21 +195,21 @@ Panel Config: metric: FLOPs (Total): avg: AVG((((((((64 * (((SQ_INSTS_VALU_ADD_F16 + SQ_INSTS_VALU_MUL_F16) + SQ_INSTS_VALU_TRANS_F16) - + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 + + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 * SQ_INSTS_VALU_MFMA_MOPS_BF16))) + (64 * (((SQ_INSTS_VALU_ADD_F32 + SQ_INSTS_VALU_MUL_F32) + SQ_INSTS_VALU_TRANS_F32) + (SQ_INSTS_VALU_FMA_F32 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F32)) + (64 * (((SQ_INSTS_VALU_ADD_F64 + SQ_INSTS_VALU_MUL_F64) + SQ_INSTS_VALU_TRANS_F64) + (SQ_INSTS_VALU_FMA_F64 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F64)) / $denom)) min: MIN((((((((64 * (((SQ_INSTS_VALU_ADD_F16 + SQ_INSTS_VALU_MUL_F16) + SQ_INSTS_VALU_TRANS_F16) - + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 + + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 * SQ_INSTS_VALU_MFMA_MOPS_BF16))) + (64 * (((SQ_INSTS_VALU_ADD_F32 + SQ_INSTS_VALU_MUL_F32) + SQ_INSTS_VALU_TRANS_F32) + (SQ_INSTS_VALU_FMA_F32 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F32)) + (64 * (((SQ_INSTS_VALU_ADD_F64 + SQ_INSTS_VALU_MUL_F64) + SQ_INSTS_VALU_TRANS_F64) + (SQ_INSTS_VALU_FMA_F64 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F64)) / $denom)) max: MAX((((((((64 * (((SQ_INSTS_VALU_ADD_F16 + SQ_INSTS_VALU_MUL_F16) + SQ_INSTS_VALU_TRANS_F16) - + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 + + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 * SQ_INSTS_VALU_MFMA_MOPS_BF16))) + (64 * (((SQ_INSTS_VALU_ADD_F32 + SQ_INSTS_VALU_MUL_F32) + SQ_INSTS_VALU_TRANS_F32) + (SQ_INSTS_VALU_FMA_F32 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F32)) + (64 * (((SQ_INSTS_VALU_ADD_F64 + SQ_INSTS_VALU_MUL_F64) + SQ_INSTS_VALU_TRANS_F64) @@ -216,6 +223,12 @@ Panel Config: max: MAX(((64 * (SQ_INSTS_VALU_INT32 + SQ_INSTS_VALU_INT64)) + (SQ_INSTS_VALU_MFMA_MOPS_I8 * 512)) / $denom) unit: (OPs + $normUnit) tips: + F8 OPs: + avg: AVG(((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) / $denom)) + min: MIN(((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) / $denom)) + max: MAX(((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) / $denom)) + unit: (OPs + $normUnit) + tips: F16 OPs: avg: AVG(((((((64 * SQ_INSTS_VALU_ADD_F16) + (64 * SQ_INSTS_VALU_MUL_F16)) + (64 * SQ_INSTS_VALU_TRANS_F16)) + (128 * SQ_INSTS_VALU_FMA_F16)) + (512 * diff --git a/src/rocprof_compute_soc/analysis_configs/gfx941/1700_L2_cache.yaml b/src/rocprof_compute_soc/analysis_configs/gfx941/1700_L2_cache.yaml index e61369c7c..b14ad71b8 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx941/1700_L2_cache.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx941/1700_L2_cache.yaml @@ -432,4 +432,4 @@ Panel Config: min: MIN((TCC_EA0_ATOMIC_sum / $denom)) max: MAX((TCC_EA0_ATOMIC_sum / $denom)) unit: (Req + $normUnit) - tips: + tips: \ No newline at end of file diff --git a/src/rocprof_compute_soc/analysis_configs/gfx942/0200_system-speed-of-light.yaml b/src/rocprof_compute_soc/analysis_configs/gfx942/0200_system-speed-of-light.yaml index cb13861c8..b0a7399e5 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx942/0200_system-speed-of-light.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx942/0200_system-speed-of-light.yaml @@ -42,6 +42,13 @@ Panel Config: pop: ((100 * AVG(((64 * (SQ_INSTS_VALU_INT32 + SQ_INSTS_VALU_INT64)) / (End_Timestamp - Start_Timestamp)))) / (((($max_sclk * $cu_per_gpu) * 64) * 2) / 1000)) tips: + MFMA FLOPs (F8): + value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_F8 * 512) / (End_Timestamp - Start_Timestamp))) + unit: GFLOP + peak: ((($max_sclk * $cu_per_gpu) * 4096) / 1000) + pop: ((100 * AVG(((SQ_INSTS_VALU_MFMA_MOPS_F8 * 512) / (End_Timestamp - Start_Timestamp)))) + / ((($max_sclk * $cu_per_gpu) * 8192) / 1000)) + tips: MFMA FLOPs (BF16): value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_BF16 * 512) / (End_Timestamp - Start_Timestamp))) unit: GFLOP diff --git a/src/rocprof_compute_soc/analysis_configs/gfx942/1000_compute-unit-instruction-mix.yaml b/src/rocprof_compute_soc/analysis_configs/gfx942/1000_compute-unit-instruction-mix.yaml index f49732e79..83ba5367a 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx942/1000_compute-unit-instruction-mix.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx942/1000_compute-unit-instruction-mix.yaml @@ -245,6 +245,12 @@ Panel Config: max: MAX((SQ_INSTS_VALU_MFMA_I8 / $denom)) unit: (instr + $normUnit) tips: + MFMA-F8: + avg: AVG((SQ_INSTS_VALU_MFMA_F8 / $denom)) + min: MIN((SQ_INSTS_VALU_MFMA_F8 / $denom)) + max: MAX((SQ_INSTS_VALU_MFMA_F8 / $denom)) + unit: (instr + $normUnit) + tips: MFMA-F16: avg: AVG((SQ_INSTS_VALU_MFMA_F16 / $denom)) min: MIN((SQ_INSTS_VALU_MFMA_F16 / $denom)) diff --git a/src/rocprof_compute_soc/analysis_configs/gfx942/1100_compute-unit-compute-pipeline.yaml b/src/rocprof_compute_soc/analysis_configs/gfx942/1100_compute-unit-compute-pipeline.yaml index a4465ebed..932d9cb5d 100644 --- a/src/rocprof_compute_soc/analysis_configs/gfx942/1100_compute-unit-compute-pipeline.yaml +++ b/src/rocprof_compute_soc/analysis_configs/gfx942/1100_compute-unit-compute-pipeline.yaml @@ -41,6 +41,13 @@ Panel Config: pop: ((100 * AVG(((64 * (SQ_INSTS_VALU_INT32 + SQ_INSTS_VALU_INT64)) / (End_Timestamp - Start_Timestamp)))) / (((($max_sclk * $cu_per_gpu) * 64) * 2) / 1000)) tips: + MFMA FLOPs (F8): + value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_F8 * 512) / (End_Timestamp - Start_Timestamp))) + unit: GFLOP + peak: ((($max_sclk * $cu_per_gpu) * 8192) / 1000) + pop: ((100 * AVG(((SQ_INSTS_VALU_MFMA_MOPS_F8 * 512) / (End_Timestamp - Start_Timestamp)))) + / ((($max_sclk * $cu_per_gpu) * 8192) / 1000)) + tips: MFMA FLOPs (BF16): value: AVG(((SQ_INSTS_VALU_MFMA_MOPS_BF16 * 512) / (End_Timestamp - Start_Timestamp))) unit: GFLOP @@ -188,21 +195,21 @@ Panel Config: metric: FLOPs (Total): avg: AVG((((((((64 * (((SQ_INSTS_VALU_ADD_F16 + SQ_INSTS_VALU_MUL_F16) + SQ_INSTS_VALU_TRANS_F16) - + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 + + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 * SQ_INSTS_VALU_MFMA_MOPS_BF16))) + (64 * (((SQ_INSTS_VALU_ADD_F32 + SQ_INSTS_VALU_MUL_F32) + SQ_INSTS_VALU_TRANS_F32) + (SQ_INSTS_VALU_FMA_F32 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F32)) + (64 * (((SQ_INSTS_VALU_ADD_F64 + SQ_INSTS_VALU_MUL_F64) + SQ_INSTS_VALU_TRANS_F64) + (SQ_INSTS_VALU_FMA_F64 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F64)) / $denom)) min: MIN((((((((64 * (((SQ_INSTS_VALU_ADD_F16 + SQ_INSTS_VALU_MUL_F16) + SQ_INSTS_VALU_TRANS_F16) - + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 + + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 * SQ_INSTS_VALU_MFMA_MOPS_BF16))) + (64 * (((SQ_INSTS_VALU_ADD_F32 + SQ_INSTS_VALU_MUL_F32) + SQ_INSTS_VALU_TRANS_F32) + (SQ_INSTS_VALU_FMA_F32 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F32)) + (64 * (((SQ_INSTS_VALU_ADD_F64 + SQ_INSTS_VALU_MUL_F64) + SQ_INSTS_VALU_TRANS_F64) + (SQ_INSTS_VALU_FMA_F64 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F64)) / $denom)) max: MAX((((((((64 * (((SQ_INSTS_VALU_ADD_F16 + SQ_INSTS_VALU_MUL_F16) + SQ_INSTS_VALU_TRANS_F16) - + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 + + (SQ_INSTS_VALU_FMA_F16 * 2))) + ((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F16) + (512 * SQ_INSTS_VALU_MFMA_MOPS_BF16))) + (64 * (((SQ_INSTS_VALU_ADD_F32 + SQ_INSTS_VALU_MUL_F32) + SQ_INSTS_VALU_TRANS_F32) + (SQ_INSTS_VALU_FMA_F32 * 2)))) + (512 * SQ_INSTS_VALU_MFMA_MOPS_F32)) + (64 * (((SQ_INSTS_VALU_ADD_F64 + SQ_INSTS_VALU_MUL_F64) + SQ_INSTS_VALU_TRANS_F64) @@ -216,6 +223,12 @@ Panel Config: max: MAX(((64 * (SQ_INSTS_VALU_INT32 + SQ_INSTS_VALU_INT64)) + (SQ_INSTS_VALU_MFMA_MOPS_I8 * 512)) / $denom) unit: (OPs + $normUnit) tips: + F8 OPs: + avg: AVG(((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) / $denom)) + min: MIN(((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) / $denom)) + max: MAX(((512 * SQ_INSTS_VALU_MFMA_MOPS_F8) / $denom)) + unit: (OPs + $normUnit) + tips: F16 OPs: avg: AVG(((((((64 * SQ_INSTS_VALU_ADD_F16) + (64 * SQ_INSTS_VALU_MUL_F16)) + (64 * SQ_INSTS_VALU_TRANS_F16)) + (128 * SQ_INSTS_VALU_FMA_F16)) + (512 * diff --git a/src/rocprof_compute_soc/profile_configs/gfx940/pmc_sq_perf1.txt b/src/rocprof_compute_soc/profile_configs/gfx940/pmc_sq_perf1.txt index 466c6c2a2..b007f2876 100644 --- a/src/rocprof_compute_soc/profile_configs/gfx940/pmc_sq_perf1.txt +++ b/src/rocprof_compute_soc/profile_configs/gfx940/pmc_sq_perf1.txt @@ -14,6 +14,10 @@ pmc: SQ_LDS_MEM_VIOLATIONS SQ_LDS_ATOMIC_RETURN SQ_LDS_IDX_ACTIVE pmc: SQ_INSTS_MFMA SQ_INSTS_VALU_MFMA_I8 SQ_INSTS_VALU_MFMA_F16 SQ_INSTS_VALU_MFMA_BF16 SQ_INSTS_VALU_MFMA_F32 SQ_INSTS_VALU_MFMA_F64 SQ_VALU_MFMA_BUSY_CYCLES pmc: SQ_INSTS_VALU_MFMA_MOPS_I8 SQ_INSTS_VALU_MFMA_MOPS_F16 SQ_INSTS_VALU_MFMA_MOPS_BF16 SQ_INSTS_VALU_MFMA_MOPS_F32 SQ_INSTS_VALU_MFMA_MOPS_F64 +#SQ:MI300 +pmc: SQ_INSTS_VALU_MFMA_F8 +pmc: SQ_INSTS_VALU_MFMA_MOPS_F8 + #SQC pmc: SQC_TC_INST_REQ SQC_TC_DATA_READ_REQ SQC_TC_DATA_WRITE_REQ SQC_TC_DATA_ATOMIC_REQ SQC_TC_STALL SQC_TC_REQ SQC_DCACHE_REQ_READ_16 pmc: SQC_ICACHE_REQ SQC_ICACHE_HITS SQC_ICACHE_MISSES SQC_ICACHE_MISSES_DUPLICATE SQC_DCACHE_INPUT_VALID_READYB SQC_DCACHE_ATOMIC SQC_DCACHE_REQ_READ_8 diff --git a/src/rocprof_compute_soc/soc_base.py b/src/rocprof_compute_soc/soc_base.py index 88f5a2209..88a2a1041 100644 --- a/src/rocprof_compute_soc/soc_base.py +++ b/src/rocprof_compute_soc/soc_base.py @@ -349,6 +349,14 @@ def perfmon_coalesce(pmc_files_list, perfmon_config, workload_dir, spatial_multi if ctr.startswith("TCC_BUBBLE"): continue + # Remove me later: + # v1 and v2 don't support these counters + if not using_v3(): + if ctr.startswith("SQ_INSTS_VALU_MFMA_F8") or ctr.startswith( + "SQ_INSTS_VALU_MFMA_MOPS_F8" + ): + continue + # Channel counter e.g. TCC_ATOMIC[0] if "[" in ctr: diff --git a/src/utils/parser.py b/src/utils/parser.py index 2e7c03d78..459d340a4 100644 --- a/src/utils/parser.py +++ b/src/utils/parser.py @@ -163,7 +163,7 @@ def to_std(a): def to_int(a): if str(type(a)) == "": - return np.nan + return None elif isinstance(a, (int, float, np.int64)): return int(a) elif isinstance(a, pd.core.series.Series): @@ -811,9 +811,8 @@ def eval_metric(dfs, dfs_type, sys_info, raw_pmc_df, debug): # print("eval_metric", id, expr) try: out = eval(compile(row[expr], "", "eval")) - if row.name != "19.1.1" and np.isnan( - out - ): # Special exception for unique format of Active CUs in mem chart + + if np.isnan(out): row[expr] = "" else: row[expr] = out diff --git a/src/utils/utils.py b/src/utils/utils.py index e0239d563..7a6c292ad 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -118,29 +118,24 @@ def get_version(rocprof_compute_home) -> dict: console_error("Cannot find VERSION file at {}".format(searchDirs)) # git version info - gitDir = str(path(rocprof_compute_home.parent).joinpath(".git")) - if (shutil.which("git") is not None) and path(gitDir).exists(): - gitQuery = subprocess.run( - ["git", "log", "--pretty=format:%h", "-n", "1"], - stdout=subprocess.PIPE, - stderr=subprocess.DEVNULL, + try: + success, output = capture_subprocess_output( + ["git", "-C", versionDir, "log", "--pretty=format:%h", "-n", "1"], ) - if gitQuery.returncode != 0: - SHA = "unknown" - MODE = "unknown" - else: - SHA = gitQuery.stdout.decode("utf-8") + if success: + SHA = output MODE = "dev" - else: - shaFile = str(path(versionDir).joinpath("VERSION.sha")) + else: + raise Exception(output) + except: try: + shaFile = path(versionDir).joinpath("VERSION.sha").absolute().resolve() with open(shaFile, "r") as file: SHA = file.read().replace("\n", "") - except EnvironmentError: - console_error("Cannot find VERSION.sha file at {}".format(shaFile)) - sys.exit(1) - - MODE = "release" + MODE = "release" + except Exception: + SHA = "unknown" + MODE = "unknown" versionData = {"version": VER, "sha": SHA, "mode": MODE} return versionData @@ -624,94 +619,36 @@ def run_prof( console_error(output, exit=False) console_error("Profiling execution failed.") + results_files = [] + if rocprof_cmd.endswith("v2"): # rocprofv2 has separate csv files for each process results_files = glob.glob(workload_dir + "/out/pmc_1/results_*.csv") - - # Combine results into single CSV file - combined_results = pd.concat( - [pd.read_csv(f) for f in results_files], ignore_index=True + elif rocprof_cmd.endswith("v3"): + # rocprofv3 requires additional processing for each process + results_files = process_rocprofv3_output( + format_rocprof_output, workload_dir, is_timestamps ) - - # Overwrite column to ensure unique IDs. - combined_results["Dispatch_ID"] = range(0, len(combined_results)) - - combined_results.to_csv( - workload_dir + "/out/pmc_1/results_" + fbase + ".csv", index=False - ) - - if rocprof_cmd.endswith("v3"): - results_files_csv = {} - if format_rocprof_output == "json": - results_files_json = glob.glob(workload_dir + "/out/pmc_1/*/*.json") - - for json_file in results_files_json: - csv_file = pathlib.Path(json_file).with_suffix(".csv") - v3_json_to_csv(json_file, csv_file) - results_files_csv = glob.glob(workload_dir + "/out/pmc_1/*/*.csv") - elif format_rocprof_output == "csv": - counter_info_csvs = glob.glob( - workload_dir + "/out/pmc_1/*/*_counter_collection.csv" + # kokkos trace output processing for --kokkos-trace + # TODO: as rocprofv3 --kokkos-trace feature improves, rocprof-compute should make updates accordingly + if "--kokkos-trace" in options: + console_debug( + "[run_prof] --kokkos-trace detected, handling *_marker_api_trace.csv outputs." ) - existing_counter_files_csv = [ - d for d in counter_info_csvs if path(d).is_file() - ] + process_kokkos_trace_output(workload_dir, fbase) + # TODO: add hip trace output processing - if len(existing_counter_files_csv) > 0: - for counter_file in existing_counter_files_csv: - current_dir = str(path(counter_file).parent) - agent_info_filepath = str( - path(current_dir).joinpath( - path(counter_file).name.replace( - "_counter_collection", "_agent_info" - ) - ) - ) - if not path(agent_info_filepath).is_file(): - raise ValueError( - '{} has no coresponding "agent info" file'.format( - counter_file - ) - ) - - converted_csv_file = str( - path(current_dir).joinpath( - path(counter_file).name.replace( - "_counter_collection", "_converted" - ) - ) - ) - - v3_counter_csv_to_v2_csv( - counter_file, agent_info_filepath, converted_csv_file - ) - - results_files_csv = glob.glob( - workload_dir + "/out/pmc_1/*/*_converted.csv" - ) - elif is_timestamps: - # when the input is timestamps, we know counter csv file is not generated and will instead parse kernel trace file - results_files_csv = glob.glob( - workload_dir + "/out/pmc_1/*/*_kernel_trace.csv" - ) - else: - # when the input is not for timestamps, and counter csv file is not generated, we assume failed rocprof run and will completely bypass the file generation and merging for current pmc - return - - else: - console_error("The output file of rocprofv3 can only support json or csv!!!") - - # Combine results into single CSV file - combined_results = pd.concat( - [pd.read_csv(f) for f in results_files_csv], ignore_index=True - ) + # Combine results into single CSV file + combined_results = pd.concat( + [pd.read_csv(f) for f in results_files], ignore_index=True + ) - # Overwrite column to ensure unique IDs. - combined_results["Dispatch_ID"] = range(0, len(combined_results)) + # Overwrite column to ensure unique IDs. + combined_results["Dispatch_ID"] = range(0, len(combined_results)) - combined_results.to_csv( - workload_dir + "/out/pmc_1/results_" + fbase + ".csv", index=False - ) + combined_results.to_csv( + workload_dir + "/out/pmc_1/results_" + fbase + ".csv", index=False + ) if new_env: # flatten tcc for applicable mi300 input @@ -757,6 +694,93 @@ def run_prof( df.to_csv(workload_dir + "/" + fbase + ".csv", index=False) +def process_rocprofv3_output(rocprof_output, workload_dir, is_timestamps): + """ + rocprofv3 specific output processing. + takes care of json or csv formats, for csv format, additional processing is performed. + """ + results_files_csv = {} + + if rocprof_output == "json": + results_files_json = glob.glob(workload_dir + "/out/pmc_1/*/*.json") + + for json_file in results_files_json: + csv_file = pathlib.Path(json_file).with_suffix(".csv") + v3_json_to_csv(json_file, csv_file) + results_files_csv = glob.glob(workload_dir + "/out/pmc_1/*/*.csv") + elif rocprof_output == "csv": + counter_info_csvs = glob.glob( + workload_dir + "/out/pmc_1/*/*_counter_collection.csv" + ) + existing_counter_files_csv = [d for d in counter_info_csvs if path(d).is_file()] + + if len(existing_counter_files_csv) > 0: + for counter_file in existing_counter_files_csv: + current_dir = str(path(counter_file).parent) + agent_info_filepath = str( + path(current_dir).joinpath( + path(counter_file).name.replace( + "_counter_collection", "_agent_info" + ) + ) + ) + if not path(agent_info_filepath).is_file(): + raise ValueError( + '{} has no coresponding "agent info" file'.format(counter_file) + ) + + converted_csv_file = str( + path(current_dir).joinpath( + path(counter_file).name.replace( + "_counter_collection", "_converted" + ) + ) + ) + + v3_counter_csv_to_v2_csv( + counter_file, agent_info_filepath, converted_csv_file + ) + + results_files_csv = glob.glob(workload_dir + "/out/pmc_1/*/*_converted.csv") + elif is_timestamps: + # when the input is timestamps, we know counter csv file is not generated and will instead parse kernel trace file + results_files_csv = glob.glob( + workload_dir + "/out/pmc_1/*/*_kernel_trace.csv" + ) + else: + # when the input is not for timestamps, and counter csv file is not generated, we assume failed rocprof run and will completely bypass the file generation and merging for current pmc + console_error("No counter csv files generated, rocprofv3 run failed!!!") + + else: + console_error("The output file of rocprofv3 can only support json or csv!!!") + + return results_files_csv + + +def process_kokkos_trace_output(workload_dir, fbase): + # marker api trace csv files are generated for each process + marker_api_trace_csvs = glob.glob( + workload_dir + "/out/pmc_1/*/*_marker_api_trace.csv" + ) + existing_marker_files_csv = [d for d in marker_api_trace_csvs if path(d).is_file()] + + # concate and output marker api trace info + combined_results = pd.concat( + [pd.read_csv(f) for f in existing_marker_files_csv], ignore_index=True + ) + + combined_results.to_csv( + workload_dir + "/out/pmc_1/results_" + fbase + "_marker_api_trace.csv", + index=False, + ) + + if path(workload_dir + "/out").exists(): + shutil.copyfile( + workload_dir + "/out/pmc_1/results_" + fbase + "_marker_api_trace.csv", + workload_dir + "/" + fbase + "_marker_api_trace.csv", + ) + + def replace_timestamps(workload_dir): df_stamps = pd.read_csv(workload_dir + "/timestamps.csv") if "Start_Timestamp" in df_stamps.columns and "End_Timestamp" in df_stamps.columns: diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 000000000..bdcb56866 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,10 @@ +import pytest + + +def pytest_addoption(parser): + parser.addoption( + "--call-binary", + action="store_true", + default=False, + help="Call standalone binary instead of main function during tests", + ) diff --git a/tests/test_analyze_commands.py b/tests/test_analyze_commands.py index 1ef861b55..e3a910ae3 100644 --- a/tests/test_analyze_commands.py +++ b/tests/test_analyze_commands.py @@ -6,10 +6,7 @@ import pandas as pd import pytest import test_utils - -rocprof_compute = SourceFileLoader("rocprof-compute", "src/rocprof-compute").load_module() - -baseline_opts = ["rocprof-compute", "analyze"] +from test_utils import binary_handler_analyze_rocprof_compute config = {} config["cleanup"] = True if "PYTEST_XDIST_WORKER_COUNT" in os.environ else False @@ -23,809 +20,440 @@ @pytest.mark.misc -def test_valid_path(): +def test_valid_path(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", workload_dir], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute(["analyze", "--path", workload_dir]) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.misc -def test_list_kernels(): +def test_list_kernels(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--list-stats", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--list-stats"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.list_metrics -def test_list_metrics_gfx90a(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", ["rocprof-compute", "analyze", "--list-metrics", "gfx90a"] - ): - rocprof_compute.main() - assert e.value.code == 1 +def test_list_metrics_gfx90a(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute(["analyze", "--list-metrics", "gfx90a"]) + assert code == 1 for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--list-metrics", - "gfx90a", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--list-metrics", "gfx90a"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.list_metrics -def test_list_metrics_gfx906(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", ["rocprof-compute", "analyze", "--list-metrics", "gfx906"] - ): - rocprof_compute.main() - assert e.value.code == 1 +def test_list_metrics_gfx906(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute(["analyze", "--list-metrics", "gfx906"]) + assert code == 1 for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--list-metrics", - "gfx906", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--list-metrics", "gfx906"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.list_metrics -def test_list_metrics_gfx908(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", ["rocprof-compute", "analyze", "--list-metrics", "gfx908"] - ): - rocprof_compute.main() - assert e.value.code == 1 +def test_list_metrics_gfx908(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute(["analyze", "--list-metrics", "gfx908"]) + assert code == 1 for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--list-metrics", - "gfx908", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--list-metrics", "gfx908"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.filter_block -def test_filter_block_1(): +def test_filter_block_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--block", - "1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--block", "1"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.filter_block -def test_filter_block_2(): +def test_filter_block_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--block", - "5", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--block", "5"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.filter_block -def test_filter_block_3(): +def test_filter_block_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--block", - "5.2.2", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--block", "5.2.2"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.filter_block -def test_filter_block_4(): +def test_filter_block_4(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--block", - "6.1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--block", "6.1"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.filter_block -def test_filter_block_5(): +def test_filter_block_5(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--block", - "10", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--block", "10"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.filter_block -def test_filter_block_6(): +def test_filter_block_6(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--block", - "100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--block", "100"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_filter_kernel_1(): +def test_filter_kernel_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel", - "0", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel", "0"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_filter_kernel_2(): +def test_filter_kernel_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel", - "1", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel", "1"] + ) + assert code == 1 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_filter_kernel_3(): +def test_filter_kernel_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel", - "0", - "1", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel", "0", "1"] + ) + assert code == 1 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_dispatch_1(): +def test_dispatch_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--dispatch", - "0", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--dispatch", "0"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_dispatch_2(): +def test_dispatch_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--dispatch", - "1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--dispatch", "1"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_dispatch_3(): +def test_dispatch_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--dispatch", - "2", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--dispatch", "2"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_dispatch_4(): +def test_dispatch_4(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--dispatch", - "1", - "4", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--dispatch", "1", "4"] + ) + assert code == 1 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_dispatch_5(): +def test_dispatch_5(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--dispatch", - "5", - "6", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--dispatch", "5", "6"] + ) + assert code == 1 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.misc -def test_gpu_ids(): +def test_gpu_ids(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--gpu-id", - "2", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--gpu-id", "2"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.normal_unit -def test_normal_unit_per_wave(): +def test_normal_unit_per_wave(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--normal-unit", - "per_wave", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--normal-unit", "per_wave"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.normal_unit -def test_normal_unit_per_cycle(): +def test_normal_unit_per_cycle(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--normal-unit", - "per_cycle", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--normal-unit", "per_cycle"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.normal_unit -def test_normal_unit_per_second(): +def test_normal_unit_per_second(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--normal-unit", - "per_second", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--normal-unit", "per_second"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.normal_unit -def test_normal_unit_per_kernel(): +def test_normal_unit_per_kernel(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--normal-unit", - "per_kernel", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--normal-unit", "per_kernel"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.max_stat -def test_max_stat_num_1(): +def test_max_stat_num_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--max-stat-num", - "0", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--max-stat-num", "0"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.max_stat -def test_max_stat_num_2(): +def test_max_stat_num_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--max-stat-num", - "5", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--max-stat-num", "5"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.max_stat -def test_max_stat_num_3(): +def test_max_stat_num_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--max-stat-num", - "10", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--max-stat-num", "10"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.max_stat -def test_max_stat_num_4(): +def test_max_stat_num_4(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--max-stat-num", - "15", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--max-stat-num", "15"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.time_unit -def test_time_unit_s(): +def test_time_unit_s(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--time-unit", - "s", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--time-unit", "s"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.time_unit -def test_time_unit_ms(): +def test_time_unit_ms(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--time-unit", - "ms", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--time-unit", "ms"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.time_unit -def test_time_unit_us(): +def test_time_unit_us(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--time-unit", - "us", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--time-unit", "us"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.time_unit -def test_time_unit_ns(): +def test_time_unit_ns(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--time-unit", - "ns", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--time-unit", "ns"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.decimal -def test_decimal_1(): +def test_decimal_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--decimal", - "0", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--decimal", "0"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.decimal -def test_decimal_2(): +def test_decimal_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--decimal", - "1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--decimal", "1"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.decimal -def test_decimal_3(): +def test_decimal_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--decimal", - "4", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--decimal", "4"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.misc -def test_save_dfs(): +def test_save_dfs(binary_handler_analyze_rocprof_compute): output_path = "tests/workloads/vcopy/saved_analysis" for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--save-dfs", - output_path, - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--save-dfs", output_path] + ) + assert code == 0 files_in_workload = os.listdir(output_path) single_row_tables = [ @@ -845,20 +473,10 @@ def test_save_dfs(): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--save-dfs", - output_path, - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--save-dfs", output_path] + ) + assert code == 0 files_in_workload = os.listdir(output_path) for file_name in files_in_workload: @@ -871,310 +489,179 @@ def test_save_dfs(): @pytest.mark.col -def test_col_1(): +def test_col_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--cols", - "0", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--cols", "0"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.col -def test_col_2(): +def test_col_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--cols", - "2", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--cols", "2"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.col -def test_col_3(): +def test_col_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--cols", - "0", - "2", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--cols", "0", "2"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.misc -def test_g(): +def test_g(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "-g", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "-g"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_0(): +def test_kernel_verbose_0(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "0", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "0"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_1(): +def test_kernel_verbose_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "1"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_2(): +def test_kernel_verbose_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "2", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "2"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_3(): +def test_kernel_verbose_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "3", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "3"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_4(): +def test_kernel_verbose_4(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "4", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "4"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_5(): +def test_kernel_verbose_5(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "5", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "5"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_6(): +def test_kernel_verbose_6(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "6", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "6"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.misc -def test_baseline(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/vcopy/MI200", - "--path", - "tests/workloads/vcopy/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/vcopy/MI200", - "--path", - "tests/workloads/vcopy/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/vcopy/MI100", - "--path", - "tests/workloads/vcopy/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 +def test_baseline(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + [ + "analyze", + "--path", + "tests/workloads/vcopy/MI200", + "--path", + "tests/workloads/vcopy/MI100", + ] + ) + assert code == 0 + + code = binary_handler_analyze_rocprof_compute( + [ + "analyze", + "--path", + "tests/workloads/vcopy/MI200", + "--path", + "tests/workloads/vcopy/MI200", + ] + ) + assert code == 1 + + code = binary_handler_analyze_rocprof_compute( + [ + "analyze", + "--path", + "tests/workloads/vcopy/MI100", + "--path", + "tests/workloads/vcopy/MI100", + ] + ) + assert code == 1 @pytest.mark.misc -def test_dependency_MI100(): +def test_dependency_MI100(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--dependency", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--dependency"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) diff --git a/tests/test_analyze_workloads.py b/tests/test_analyze_workloads.py index 3b0b315ee..eddd54937 100644 --- a/tests/test_analyze_workloads.py +++ b/tests/test_analyze_workloads.py @@ -1,1947 +1,941 @@ -import inspect -import re -import shutil -import subprocess -import sys -from importlib.machinery import SourceFileLoader from unittest.mock import patch import pandas as pd import pytest -import test_utils - -rocprof_compute = SourceFileLoader("rocprof-compute", "src/rocprof-compute").load_module() +from test_utils import binary_handler_analyze_rocprof_compute ################################################## ## Generated tests ## ################################################## -def test_analyze_vcopy_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/vcopy/MI100"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_vcopy_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/vcopy/MI200"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCP_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCP/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCP_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCP/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCP_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCP/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCP_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCP/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQC_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQC/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQC_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQC/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQC_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQC/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQC_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQC/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_mem_levels_HBM_LDS_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_HBM_LDS/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCC_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCC/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCC_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCC/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCC_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCC/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCC_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCC/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_no_roof_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/no_roof/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_no_roof_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/no_roof/MI100"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_no_roof_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/no_roof/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_no_roof_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/no_roof/MI200"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_CPC_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_CPC/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_CPC_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_CPC/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_CPC_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_CPC/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_CPC_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_CPC/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_grid_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_grid/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_grid_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_grid/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_grid_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_grid/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_grid_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_grid/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/kernel/MI100"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/kernel/MI200"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_substr_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_substr/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_substr_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_substr/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_substr_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_substr/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_substr_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_substr/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_7_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_7/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_7_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_7/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_dispatch_7_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_7/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_7_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_7/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_kernel_inv_int_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_int/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_inv_int_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_int/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_kernel_inv_int_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_int/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_inv_int_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_int/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_mem_levels_vL1D_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_vL1D/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_sort_kernels_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/sort_kernels/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_inv_str_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_str/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_inv_str_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_str/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_kernel_inv_str_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_str/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_inv_str_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_str/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_ipblocks_SQ_SPI_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_2_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_2/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_2_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_2/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_2_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_2/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_2_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_2/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_1_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0_1/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_1_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0_1/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_1_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0_1/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_1_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0_1/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_mem_levels_LDS_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_LDS/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TA_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TA/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TA_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TA/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TA_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TA/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TA_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TA/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_6_8_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_6_8/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_6_8_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_6_8/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_dispatch_6_8_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_6_8/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_6_8_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_6_8/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_device_inv_int_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_inv_int/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_inv_int_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_inv_int/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_inv_int_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_inv_int/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_inv_int_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_inv_int/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_TA_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_TA/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_TA_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_TA/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_TA_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_TA/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_TA_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_TA/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TD_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TD/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TD_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TD/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TD_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TD/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TD_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TD/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_filter_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_filter/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_filter_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_filter/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_filter_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_filter/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_filter_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_filter/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_kernel_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_kernel/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_kernel_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_kernel/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_kernel_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_kernel/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_kernel_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_kernel/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_mem_levels_L2_vL1d_LDS_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_L2_vL1d_LDS/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPF_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPF/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPF_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPF/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPF_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPF/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPF_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPF/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_sort_dispatches_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/sort_dispatches/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_names_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_names/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_mem_levels_vL1d_LDS_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_vL1d_LDS/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_mem_levels_L2_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_L2/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_inv_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_inv/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_inv_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_inv/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_inv_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_inv/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_inv_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_inv/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_path_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/path/MI300X_A1"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_path_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/path/MI100"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_path_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/path/MI300A_A1"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_path_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/path/MI200"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPC_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPC/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPC_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPC/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPC_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPC/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPC_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPC/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_mem_levels_HBM_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_HBM/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SPI_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SPI/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SPI_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SPI/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SPI_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SPI/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SPI_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SPI/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 +def test_analyze_vcopy_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/vcopy/MI100"] + ) + assert code == 0 + + +def test_analyze_vcopy_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/vcopy/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCP_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCP/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCP_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCP/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCP_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCP/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCP_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCP/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQC_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQC/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQC_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQC/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQC_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQC/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQC_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQC/MI200"] + ) + assert code == 0 + + +def test_analyze_mem_levels_HBM_LDS_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_HBM_LDS/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCC_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCC/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCC_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCC/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCC_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCC/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCC_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCC/MI200"] + ) + assert code == 0 + + +def test_analyze_no_roof_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/no_roof/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_no_roof_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/no_roof/MI100"] + ) + assert code == 0 + + +def test_analyze_no_roof_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/no_roof/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_no_roof_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/no_roof/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_CPC_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_CPC/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_CPC_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_CPC/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_CPC_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_CPC/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_CPC_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_CPC/MI200"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0/MI100"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0/MI200"] + ) + assert code == 0 + + +def test_analyze_join_type_grid_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_grid/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_join_type_grid_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_grid/MI100"] + ) + assert code == 0 + + +def test_analyze_join_type_grid_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_grid/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_join_type_grid_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_grid/MI200"] + ) + assert code == 0 + + +def test_analyze_kernel_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel/MI100"] + ) + assert code == 0 + + +def test_analyze_kernel_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel/MI200"] + ) + assert code == 0 + + +def test_analyze_kernel_substr_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_substr/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_substr_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_substr/MI100"] + ) + assert code == 0 + + +def test_analyze_kernel_substr_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_substr/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_substr_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_substr/MI200"] + ) + assert code == 0 + + +def test_analyze_dispatch_7_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_7/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_7_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_7/MI100"] + ) + assert code == 1 + + +def test_analyze_dispatch_7_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_7/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_7_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_7/MI200"] + ) + assert code == 1 + + +def test_analyze_kernel_inv_int_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_int/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_inv_int_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_int/MI100"] + ) + assert code == 1 + + +def test_analyze_kernel_inv_int_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_int/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_inv_int_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_int/MI200"] + ) + assert code == 1 + + +def test_analyze_mem_levels_vL1D_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_vL1D/MI200"] + ) + assert code == 0 + + +def test_analyze_sort_kernels_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/sort_kernels/MI200"] + ) + assert code == 0 + + +def test_analyze_kernel_inv_str_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_str/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_inv_str_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_str/MI100"] + ) + assert code == 1 + + +def test_analyze_kernel_inv_str_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_str/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_inv_str_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_str/MI200"] + ) + assert code == 1 + + +def test_analyze_ipblocks_SQ_SPI_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI/MI200"] + ) + assert code == 0 + + +def test_analyze_dispatch_2_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_2/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_2_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_2/MI100"] + ) + assert code == 0 + + +def test_analyze_dispatch_2_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_2/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_2_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_2/MI200"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_1_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0_1/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_1_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0_1/MI100"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_1_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0_1/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_1_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0_1/MI200"] + ) + assert code == 0 + + +def test_analyze_mem_levels_LDS_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_LDS/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TA_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TA/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TA_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TA/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TA_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TA/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TA_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TA/MI200"] + ) + assert code == 0 + + +def test_analyze_dispatch_6_8_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_6_8/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_6_8_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_6_8/MI100"] + ) + assert code == 1 + + +def test_analyze_dispatch_6_8_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_6_8/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_6_8_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_6_8/MI200"] + ) + assert code == 1 + + +def test_analyze_device_inv_int_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_inv_int/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_device_inv_int_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_inv_int/MI100"] + ) + assert code == 0 + + +def test_analyze_device_inv_int_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_inv_int/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_device_inv_int_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_inv_int/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_TA_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_TA/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_TA_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_TA/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_TA_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_TA/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_TA_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_TA/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TD_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TD/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TD_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TD/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TD_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TD/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TD_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TD/MI200"] + ) + assert code == 0 + + +def test_analyze_device_filter_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_filter/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_device_filter_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_filter/MI100"] + ) + assert code == 0 + + +def test_analyze_device_filter_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_filter/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_device_filter_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_filter/MI200"] + ) + assert code == 0 + + +def test_analyze_join_type_kernel_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_kernel/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_join_type_kernel_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_kernel/MI100"] + ) + assert code == 0 + + +def test_analyze_join_type_kernel_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_kernel/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_join_type_kernel_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_kernel/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI300X_A1( + binary_handler_analyze_rocprof_compute, +): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI300A_A1( + binary_handler_analyze_rocprof_compute, +): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI200"] + ) + assert code == 0 + + +def test_analyze_mem_levels_L2_vL1d_LDS_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_L2_vL1d_LDS/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPF_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPF/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPF_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPF/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPF_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPF/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPF_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPF/MI200"] + ) + assert code == 0 + + +def test_analyze_sort_dispatches_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/sort_dispatches/MI200"] + ) + assert code == 0 + + +def test_analyze_kernel_names_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_names/MI200"] + ) + assert code == 0 + + +def test_analyze_mem_levels_vL1d_LDS_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_vL1d_LDS/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ/MI200"] + ) + assert code == 0 + + +def test_analyze_mem_levels_L2_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_L2/MI200"] + ) + assert code == 0 + + +def test_analyze_dispatch_inv_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_inv/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_inv_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_inv/MI100"] + ) + assert code == 0 + + +def test_analyze_dispatch_inv_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_inv/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_inv_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_inv/MI200"] + ) + assert code == 0 + + +def test_analyze_path_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/path/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_path_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/path/MI100"] + ) + assert code == 0 + + +def test_analyze_path_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/path/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_path_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/path/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPC_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPC/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPC_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPC/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPC_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPC/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPC_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPC/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI300X_A1( + binary_handler_analyze_rocprof_compute, +): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI300A_A1( + binary_handler_analyze_rocprof_compute, +): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI200"] + ) + assert code == 0 + + +def test_analyze_mem_levels_HBM_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_HBM/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SPI_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SPI/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SPI_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SPI/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SPI_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SPI/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SPI_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SPI/MI200"] + ) + assert code == 0 diff --git a/tests/test_profile_general.py b/tests/test_profile_general.py index fe2f5ef6f..04eeeeddc 100644 --- a/tests/test_profile_general.py +++ b/tests/test_profile_general.py @@ -11,6 +11,7 @@ import pandas as pd import pytest import test_utils +from test_utils import binary_handler_profile_rocprof_compute # Globals @@ -35,9 +36,6 @@ # -- config = {} -config["rocprofiler-compute"] = SourceFileLoader( - "rocprofiler-compute", "src/rocprof-compute" -).load_module() config["kernel_name_1"] = "vecCopy" config["app_1"] = ["./tests/vcopy", "-n", "1048576", "-b", "256", "-i", "3"] config["cleanup"] = True @@ -45,13 +43,8 @@ config["METRIC_COMPARE"] = False config["METRIC_LOGGING"] = False -# default option is no roof to reduce test run time -baseline_opts = ["rocprof-compute", "profile", "--no-roof", "-n", "app_1", "-VVV"] -baseline_with_roof_opts = ["rocprof-compute", "profile", "-n", "app_1", "-VVV"] - num_kernels = 3 num_devices = 1 -dispatch_id = 0 DEFAULT_ABS_DIFF = 15 DEFAULT_REL_DIFF = 50 @@ -497,10 +490,9 @@ def validate(test_name, workload_dir, file_dict, args=[]): @pytest.mark.misc -def test_path(): - options = baseline_opts +def test_path(binary_handler_profile_rocprof_compute): workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) @@ -520,22 +512,22 @@ def test_path(): @pytest.mark.misc -def test_kernel_names(): - options = baseline_with_roof_opts + ["--roof-only", "--kernel-names"] +def test_kernel_names(binary_handler_profile_rocprof_compute): + options = ["--device", "0", "--roof-only", "--kernel-names"] workload_dir = test_utils.get_output_dir() - e = test_utils.launch_rocprof_compute( - config, options, workload_dir, check_success=False + returncode = binary_handler_profile_rocprof_compute( + config, workload_dir, options, check_success=False, roof=True ) if soc == "MI100": # assert that it did not run - assert e.value.code >= 1 + assert returncode >= 1 # Do not continue testing return # assert successful run - assert e.value.code == 0 + assert returncode == 0 - file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) + file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels) if soc == "MI200" or "MI300" in soc: assert sorted(list(file_dict.keys())) == sorted( ROOF_ONLY_FILES + ["kernelName_legend.pdf"] @@ -553,14 +545,10 @@ def test_kernel_names(): @pytest.mark.misc -def test_device_filter(): - device_id = "0" - # if "HIP_VISIBLE_DEVICES" in os.environ: - # device_id = os.environ["HIP_VISIBLE_DEVICES"] - - options = baseline_opts + ["--device", device_id] +def test_device_filter(binary_handler_profile_rocprof_compute): + options = ["--device", "0"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels) if soc == "MI100": @@ -585,10 +573,10 @@ def test_device_filter(): @pytest.mark.kernel_execution -def test_kernel(): - options = baseline_opts + ["--kernel", config["kernel_name_1"]] +def test_kernel(binary_handler_profile_rocprof_compute): + options = ["--kernel", config["kernel_name_1"]] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) if soc == "MI100": @@ -611,10 +599,10 @@ def test_kernel(): @pytest.mark.block -def test_block_SQ(): - options = baseline_opts + ["--block", "SQ"] +def test_block_SQ(binary_handler_profile_rocprof_compute): + options = ["--block", "SQ"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -666,10 +654,10 @@ def test_block_SQ(): @pytest.mark.block -def test_block_SQC(): - options = baseline_opts + ["--block", "SQC"] +def test_block_SQC(binary_handler_profile_rocprof_compute): + options = ["--block", "SQC"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -694,10 +682,10 @@ def test_block_SQC(): @pytest.mark.block -def test_block_TA(): - options = baseline_opts + ["--block", "TA"] +def test_block_TA(binary_handler_profile_rocprof_compute): + options = ["--block", "TA"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -726,10 +714,10 @@ def test_block_TA(): @pytest.mark.block -def test_block_TD(): - options = baseline_opts + ["--block", "TD"] +def test_block_TD(binary_handler_profile_rocprof_compute): + options = ["--block", "TD"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -763,10 +751,10 @@ def test_block_TD(): @pytest.mark.block -def test_block_TCP(): - options = baseline_opts + ["--block", "TCP"] +def test_block_TCP(binary_handler_profile_rocprof_compute): + options = ["--block", "TCP"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -797,10 +785,10 @@ def test_block_TCP(): @pytest.mark.block -def test_block_TCC(): - options = baseline_opts + ["--block", "TCC"] +def test_block_TCC(binary_handler_profile_rocprof_compute): + options = ["--block", "TCC"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -847,10 +835,10 @@ def test_block_TCC(): @pytest.mark.block -def test_block_SPI(): - options = baseline_opts + ["--block", "SPI"] +def test_block_SPI(binary_handler_profile_rocprof_compute): + options = ["--block", "SPI"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -880,10 +868,10 @@ def test_block_SPI(): @pytest.mark.block -def test_block_CPC(): - options = baseline_opts + ["--block", "CPC"] +def test_block_CPC(binary_handler_profile_rocprof_compute): + options = ["--block", "CPC"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -906,10 +894,10 @@ def test_block_CPC(): @pytest.mark.block -def test_block_CPF(): - options = baseline_opts + ["--block", "CPF"] +def test_block_CPF(binary_handler_profile_rocprof_compute): + options = ["--block", "CPF"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -933,10 +921,10 @@ def test_block_CPF(): @pytest.mark.block -def test_block_SQ_CPC(): - options = baseline_opts + ["--block", "SQ", "CPC"] +def test_block_SQ_CPC(binary_handler_profile_rocprof_compute): + options = ["--block", "SQ", "CPC"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -988,10 +976,10 @@ def test_block_SQ_CPC(): @pytest.mark.block -def test_block_SQ_TA(): - options = baseline_opts + ["--block", "SQ", "TA"] +def test_block_SQ_TA(binary_handler_profile_rocprof_compute): + options = ["--block", "SQ", "TA"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -1039,10 +1027,10 @@ def test_block_SQ_TA(): @pytest.mark.block -def test_block_SQ_SPI(): - options = baseline_opts + ["--block", "SQ", "SPI"] +def test_block_SQ_SPI(binary_handler_profile_rocprof_compute): + options = ["--block", "SQ", "SPI"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -1093,10 +1081,10 @@ def test_block_SQ_SPI(): @pytest.mark.block -def test_block_SQ_SQC_TCP_CPC(): - options = baseline_opts + ["--block", "SQ", "SQC", "TCP", "CPC"] +def test_block_SQ_SQC_TCP_CPC(binary_handler_profile_rocprof_compute): + options = ["--block", "SQ", "SQC", "TCP", "CPC"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -1144,10 +1132,10 @@ def test_block_SQ_SQC_TCP_CPC(): @pytest.mark.block -def test_block_SQ_SPI_TA_TCC_CPF(): - options = baseline_opts + ["--block", "SQ", "SPI", "TA", "TCC", "CPF"] +def test_block_SQ_SPI_TA_TCC_CPF(binary_handler_profile_rocprof_compute): + options = ["--block", "SQ", "SPI", "TA", "TCC", "CPF"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -1199,10 +1187,10 @@ def test_block_SQ_SPI_TA_TCC_CPF(): @pytest.mark.dispatch -def test_dispatch_0(): - options = baseline_opts + ["--dispatch", "0"] +def test_dispatch_0(binary_handler_profile_rocprof_compute): + options = ["--dispatch", "0"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, 1) if soc == "MI100": @@ -1229,10 +1217,10 @@ def test_dispatch_0(): @pytest.mark.dispatch -def test_dispatch_0_1(): - options = baseline_opts + ["--dispatch", "0:2"] +def test_dispatch_0_1(binary_handler_profile_rocprof_compute): + options = ["--dispatch", "0:2"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, 2) if soc == "MI100": @@ -1256,10 +1244,10 @@ def test_dispatch_0_1(): @pytest.mark.dispatch -def test_dispatch_2(): - options = baseline_opts + ["--dispatch", dispatch_id] +def test_dispatch_2(binary_handler_profile_rocprof_compute): + options = ["--dispatch", "0"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, 1) if soc == "MI100": @@ -1278,7 +1266,7 @@ def test_dispatch_2(): file_dict, [ "--dispatch", - str(dispatch_id), + "0", ], ) @@ -1286,10 +1274,10 @@ def test_dispatch_2(): @pytest.mark.join -def test_join_type_grid(): - options = baseline_opts + ["--join-type", "grid"] +def test_join_type_grid(binary_handler_profile_rocprof_compute): + options = ["--join-type", "grid"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) if soc == "MI100": @@ -1312,10 +1300,10 @@ def test_join_type_grid(): @pytest.mark.join -def test_join_type_kernel(): - options = baseline_opts + ["--join-type", "kernel"] +def test_join_type_kernel(binary_handler_profile_rocprof_compute): + options = ["--join-type", "kernel"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) @@ -1339,27 +1327,22 @@ def test_join_type_kernel(): @pytest.mark.sort -def test_sort_dispatches(): +def test_sort_dispatches(binary_handler_profile_rocprof_compute): # only test 1 device for roofline - device_id = "0" - options = ( - baseline_with_roof_opts - + ["--device", device_id] - + ["--roof-only", "--sort", "dispatches"] - ) + options = ["--device", "0", "--roof-only", "--sort", "dispatches"] workload_dir = test_utils.get_output_dir() - e = test_utils.launch_rocprof_compute( - config, options, workload_dir, check_success=False + returncode = binary_handler_profile_rocprof_compute( + config, workload_dir, options, check_success=False, roof=True ) if soc == "MI100": # assert that it did not run - assert e.value.code >= 1 + assert returncode >= 1 # Do not continue testing return # assert successful run - assert e.value.code == 0 + assert returncode == 0 file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels) @@ -1378,27 +1361,22 @@ def test_sort_dispatches(): @pytest.mark.sort -def test_sort_kernels(): +def test_sort_kernels(binary_handler_profile_rocprof_compute): # only test 1 device for roofline - device_id = "0" - options = ( - baseline_with_roof_opts - + ["--device", device_id] - + ["--roof-only", "--sort", "kernels"] - ) + options = ["--device", "0", "--roof-only", "--sort", "kernels"] workload_dir = test_utils.get_output_dir() - e = test_utils.launch_rocprof_compute( - config, options, workload_dir, check_success=False + returncode = binary_handler_profile_rocprof_compute( + config, workload_dir, options, check_success=False, roof=True ) if soc == "MI100": # assert that it did not run - assert e.value.code >= 1 + assert returncode >= 1 # Do not continue testing return # assert successful run - assert e.value.code == 0 + assert returncode == 0 file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels) if soc == "MI200" or "MI300" in soc: @@ -1416,27 +1394,22 @@ def test_sort_kernels(): @pytest.mark.mem -def test_mem_levels_vL1D(): +def test_mem_levels_vL1D(binary_handler_profile_rocprof_compute): # only test 1 device for roofline - device_id = "0" - options = ( - baseline_with_roof_opts - + ["--device", device_id] - + ["--roof-only", "--mem-level", "vL1D"] - ) + options = ["--device", "0", "--roof-only", "--mem-level", "vL1D"] workload_dir = test_utils.get_output_dir() - e = test_utils.launch_rocprof_compute( - config, options, workload_dir, check_success=False + returncode = binary_handler_profile_rocprof_compute( + config, workload_dir, options, check_success=False, roof=True ) if soc == "MI100": # assert that it did not run - assert e.value.code >= 1 + assert returncode >= 1 # Do not continue testing return # assert successful run - assert e.value.code == 0 + assert returncode == 0 file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels) if soc == "MI200" or "MI300" in soc: @@ -1454,27 +1427,22 @@ def test_mem_levels_vL1D(): @pytest.mark.mem -def test_mem_levels_LDS(): +def test_mem_levels_LDS(binary_handler_profile_rocprof_compute): # only test 1 device for roofline - device_id = "0" - options = ( - baseline_with_roof_opts - + ["--device", device_id] - + ["--roof-only", "--mem-level", "LDS"] - ) + options = ["--device", "0", "--roof-only", "--mem-level", "LDS"] workload_dir = test_utils.get_output_dir() - e = test_utils.launch_rocprof_compute( - config, options, workload_dir, check_success=False + returncode = binary_handler_profile_rocprof_compute( + config, workload_dir, options, check_success=False, roof=True ) if soc == "MI100": # assert that it did not run - assert e.value.code >= 1 + assert returncode >= 1 # Do not continue testing return # assert successful run - assert e.value.code == 0 + assert returncode == 0 file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels) if soc == "MI200" or "MI300" in soc: diff --git a/tests/test_utils.py b/tests/test_utils.py index f2beaf7e8..e1a3c2c7e 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -26,12 +26,16 @@ import inspect import os import shutil +import subprocess +from importlib.machinery import SourceFileLoader from pathlib import Path from unittest.mock import patch import pandas as pd import pytest +rocprof_compute = SourceFileLoader("rocprof-compute", "src/rocprof-compute").load_module() + def check_resource_allocation(): """Check if CTEST resource allocation is enabled for parallel testing and set @@ -128,26 +132,67 @@ def check_csv_files(output_dir, num_devices, num_kernels): return file_dict -def launch_rocprof_compute(config, options, workload_dir, check_success=True): - """Launch ROCm Compute Profiler with command-line optoins - - Args: - config (list): runtime configuration settings - options (list): command line options to provide to rocprofiler-compute - workload_dir (string): desired output directory - check_success (bool, optional): Whether to verify successful exit condition. Defaults to True. - - Returns: - exception: SystemExit exception - """ - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", options + ["--path", workload_dir, "--"] + config["app_1"] - ): - config["rocprofiler-compute"].main() - - # verify run status - if check_success: - assert e.value.code == 0 - - return e +@pytest.fixture +def binary_handler_profile_rocprof_compute(request): + def _handler(config, workload_dir, options=[], check_success=True, roof=False): + if request.config.getoption("--call-binary"): + baseline_opts = [ + "build/rocprof-compute.bin", + "profile", + "-n", + "app_1", + "-VVV", + ] + if not roof: + baseline_opts.append("--no-roof") + process = subprocess.run( + baseline_opts + + options + + ["--path", workload_dir, "--"] + + config["app_1"], + text=True, + ) + # verify run status + if check_success: + assert process.returncode == 0 + return process.returncode + else: + baseline_opts = ["rocprof-compute", "profile", "-n", "app_1", "-VVV"] + if not roof: + baseline_opts.append("--no-roof") + with pytest.raises(SystemExit) as e: + with patch( + "sys.argv", + baseline_opts + + options + + ["--path", workload_dir, "--"] + + config["app_1"], + ): + rocprof_compute.main() + # verify run status + if check_success: + assert e.value.code == 0 + return e.value.code + + return _handler + + +@pytest.fixture +def binary_handler_analyze_rocprof_compute(request): + def _handler(arguments): + if request.config.getoption("--call-binary"): + process = subprocess.run( + ["build/rocprof-compute.bin", *arguments], + text=True, + ) + return process.returncode + else: + with pytest.raises(SystemExit) as e: + with patch( + "sys.argv", + ["rocprof-compute", *arguments], + ): + rocprof_compute.main() + return e.value.code + + return _handler diff --git a/utils/docker_env/docker-compose.yml b/utils/docker_env/docker-compose.yml deleted file mode 100644 index c040632e7..000000000 --- a/utils/docker_env/docker-compose.yml +++ /dev/null @@ -1,10 +0,0 @@ -services: - app: - build: - context: ../../ - dockerfile: utils/docker_env/Dockerfile - devices: - - /dev/kfd - - /dev/dri - security_opt: - - seccomp:unconfined \ No newline at end of file