CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
110 lines
3.4 KiB
C++
110 lines
3.4 KiB
C++
// MIT License
|
|
//
|
|
// Copyright (c) 2024-2026 Advanced Micro Devices, Inc. All rights reserved.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
// in the Software without restriction, including without limitation the rights
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
// furnished to do so, subject to the following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included in all
|
|
// copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
// 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.
|
|
|
|
#pragma once
|
|
#include <stdint.h>
|
|
#include <algorithm>
|
|
#include <cassert>
|
|
#include <cctype>
|
|
#include <cstdint>
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <memory>
|
|
#include <regex>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <unordered_map>
|
|
#include <utility>
|
|
#include <vector>
|
|
#include "rocprof_trace_decoder/cxx/common.hpp"
|
|
|
|
enum class InstCategory
|
|
{
|
|
SKIP = WaveInstCategory::NONE,
|
|
SMEM = WaveInstCategory::SMEM,
|
|
SALU = WaveInstCategory::SALU,
|
|
VMEM = WaveInstCategory::VMEM,
|
|
FLAT = WaveInstCategory::FLAT,
|
|
LDS = WaveInstCategory::LDS,
|
|
VALU = WaveInstCategory::VALU,
|
|
IMMED = WaveInstCategory::IMMED,
|
|
BVH = WaveInstCategory::BVH,
|
|
DONT_KNOW = WaveInstCategory::WAVE_NOT_FINISHED + 1,
|
|
BRANCH,
|
|
BARRIER_WAIT_EXCLUDED,
|
|
MFMA_SCALE,
|
|
GFX9_BARRIER,
|
|
V_MOV_B64,
|
|
LAST
|
|
};
|
|
|
|
inline bool operator==(const InstCategory& cat, uint64_t value) { return static_cast<uint64_t>(cat) == value; }
|
|
inline bool operator==(uint64_t value, const InstCategory& cat) { return static_cast<uint64_t>(cat) == value; }
|
|
|
|
class Trie;
|
|
Trie& get_instruction_trie();
|
|
|
|
class Trie
|
|
{
|
|
public:
|
|
Trie();
|
|
|
|
InstCategory type_from_trie(const std::string_view inst) const;
|
|
|
|
static InstCategory inst_type(const std::string_view line, int gfxip)
|
|
{
|
|
if (line.find("branch") != std::string::npos) return InstCategory::BRANCH;
|
|
|
|
InstCategory type = get_instruction_trie().type_from_trie(line);
|
|
|
|
if (type == InstCategory::VALU)
|
|
{
|
|
// Check for scale MFMA
|
|
if (gfxip == 9 && line.find("v_mfma_scale_") == 0)
|
|
type = InstCategory::MFMA_SCALE;
|
|
else if (gfxip == 12 && line.find("v_mov_b64") == 0)
|
|
type = InstCategory::V_MOV_B64;
|
|
}
|
|
else if (gfxip == 9 && type == InstCategory::IMMED)
|
|
{
|
|
if (line.find("s_barrier") == 0) type = InstCategory::GFX9_BARRIER;
|
|
}
|
|
else if (gfxip == 12 && type == InstCategory::LDS)
|
|
{
|
|
if (line.find("ds_bvh") == 0) return InstCategory::BVH;
|
|
}
|
|
|
|
return type;
|
|
}
|
|
|
|
private:
|
|
struct Node
|
|
{
|
|
InstCategory type = InstCategory::LAST;
|
|
std::unordered_map<char, std::unique_ptr<Node>> paths;
|
|
};
|
|
|
|
void add_type(std::string_view inst_header, InstCategory type);
|
|
|
|
Node root;
|
|
};
|