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
176 lines
6.0 KiB
C++
176 lines
6.0 KiB
C++
/*******************************************************************************
|
|
*
|
|
* MIT License
|
|
*
|
|
* Copyright (C) 2022-2025 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 <cstdlib>
|
|
#include <set>
|
|
#include <string>
|
|
#include <tensilelitehost/export.h>
|
|
|
|
#ifdef Tensile_ENABLE_MARKER
|
|
#include <roctracer/roctx.h>
|
|
#endif
|
|
|
|
#include <Tensile/Singleton.hpp>
|
|
|
|
namespace TensileLite
|
|
{
|
|
using StringSet = std::set<std::string>;
|
|
|
|
/**
|
|
* @brief Common place for defining flags which enable debug behaviour.
|
|
*/
|
|
class TENSILELITEHOST_EXPORT Debug : public LazySingleton<Debug>
|
|
{
|
|
public:
|
|
bool printPropertyEvaluation() const;
|
|
bool printPredicateEvaluation() const;
|
|
bool printPredicateEvaluationVerbose() const;
|
|
bool printDeviceSelection() const;
|
|
bool printCodeObjectInfo() const;
|
|
bool printKernelArguments() const;
|
|
bool printDataInit() const;
|
|
bool printTensorInfo() const; // print tensor dims, strides, memory sizes
|
|
bool printTensorModeHex() const; // if tensors are printed, use hexadecimal output format
|
|
bool printLibraryVersion() const;
|
|
bool printLookupEfficiency() const;
|
|
bool printWinningKernelName() const;
|
|
|
|
// Re-reads TENSILE_DB, TENSILE_DB2, and TENSILE_STREAMK5_FORCE_MODE from
|
|
// the environment and updates cached state. Only these three fields are
|
|
// refreshed; all other env-driven settings remain at their initial values.
|
|
// Intended for tests that call setenv() in-process after the singleton has
|
|
// already been constructed.
|
|
//
|
|
// Thread safety: must only be called when no concurrent TensileLite
|
|
// operations are in flight (e.g., between GEMM calls in a serial test).
|
|
void reloadDebugBitsForTest();
|
|
|
|
bool usePredictionLibrary() const;
|
|
|
|
bool printLibraryLogicIndex() const;
|
|
|
|
// Reports the effective Stream-K (SK5 hybrid) scheduling mode selected at
|
|
// runtime by streamK5EffectiveDynamic(). Gated by TENSILE_DB bit 0x100000.
|
|
bool printStreamKModeSelection() const;
|
|
|
|
bool naivePropertySearch() const;
|
|
|
|
bool skipKernelLaunch() const;
|
|
|
|
bool useStreamKDataParrallel() const;
|
|
|
|
// SK5 hybrid mode debug override.
|
|
// Return value semantics:
|
|
// -1 -> respect the API attribute / GemmPreference setting
|
|
// 0 -> force the static (SK3) path
|
|
// 1 -> force the dynamic (SK4) path
|
|
// Sourced from the TENSILE_STREAMK5_FORCE_MODE environment variable.
|
|
int streamK5ForceMode() const;
|
|
|
|
int useExperimentalSelection() const;
|
|
|
|
std::string getMetric() const;
|
|
|
|
bool getBenchmark() const;
|
|
|
|
int getSolutionIndex() const;
|
|
|
|
bool printSolutionSelectionTime() const;
|
|
|
|
int getGridbasedTopSols() const;
|
|
|
|
bool printStreamKGridInfo() const;
|
|
|
|
bool gridBasedKDTree() const;
|
|
|
|
bool gridBasedBatchExp() const;
|
|
|
|
bool disableStaggerU() const;
|
|
|
|
StringSet excludedLibFromGetAll() const;
|
|
|
|
void setExcludedLibFromGetAll(StringSet& excludedSet);
|
|
|
|
__attribute__((always_inline)) inline void markerStart(const char* name) const
|
|
{
|
|
#ifdef Tensile_ENABLE_MARKER
|
|
if(m_printMarker)
|
|
{
|
|
roctxRangePush(name);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
__attribute__((always_inline)) inline void markerStart(const char* name,
|
|
const std::string& objPath) const
|
|
{
|
|
#ifdef Tensile_ENABLE_MARKER
|
|
if(m_printMarker)
|
|
{
|
|
std::string s = name + std::string(": ") + objPath;
|
|
roctxRangePush(s.c_str());
|
|
}
|
|
#endif
|
|
}
|
|
|
|
__attribute__((always_inline)) inline void markerStop() const
|
|
{
|
|
#ifdef Tensile_ENABLE_MARKER
|
|
if(m_printMarker)
|
|
{
|
|
roctxRangePop();
|
|
}
|
|
#endif
|
|
}
|
|
|
|
private:
|
|
friend LazySingleton<Debug>;
|
|
|
|
int m_value;
|
|
int m_value2;
|
|
bool m_naivePropertySearch = false;
|
|
bool m_dataParallel = false;
|
|
int m_experimentSelection = 0;
|
|
int m_solution_index = -1;
|
|
bool m_predictionLib = false;
|
|
std::string m_metric = "";
|
|
int m_gridbasedTopSols = 1;
|
|
bool m_benchmark = false;
|
|
bool m_gridbasedKdTree = false;
|
|
bool m_gridbasedBatchExp = false;
|
|
bool m_printMarker = false;
|
|
bool m_disableStaggerU = false;
|
|
// -1 = unset (use API attribute); 0 = force static SK3; 1 = force dynamic SK4
|
|
int m_streamK5ForceMode = -1;
|
|
StringSet m_excludedFromGetAll;
|
|
|
|
Debug();
|
|
};
|
|
} // namespace TensileLite
|
|
|