fde741c2b4
SWDEV-189990, SWDEV-190337 - Update OpenCL/PAL gfx10 counter blocks again to match GPUPerfAPI. SWDEV-190337: - Update the GFX10 block list (gfx10BlockIsPal) to match GPUPerfAPI, which expects the OpenCL block lists to match OpenGL (UGL). Note: The list now matches the expectations of GPUPerfAPI. For TA/TD/TCP, nearly all GFX10 ASICs only require 10 or 12 instances (Arden would require 14, Mero would require 8, but not sure if those are supported by OCL), but we are using 16 instances to match UGL. - Make sure the blockIdToIndexSelect array contains all the blocks supported by PAL (add a static_assert to ensure this) - Refactor the PCIndexSelect enum. This enum is used to determine how to sum up counters across multiple block instances. The following types are now supported: Instance -- no autosumming; instances have a one-to-one correlation with PAL ShaderEngine -- the block is instanced per shader engine, and OpenCL will autosum counters across all PAL instances, providing a single value for all of PAL's instances ShaderArray -- the block is instanced per shader array, and OpenCL will autosum counters across shader arrays, providing a single value for each instance within a shader array. For example, if a block has four instances per shader array, PAL would expose 16 instances total on Navi10 (2 SEs, 2 SAs per SE), but OpenCL will expose four instances ComputeUnit -- the block is instanced per compute unit, and OpenCL will autosum counters across shader arrays, providing a single value for each compute-unit-per-shader-array. For example, if a block is instanced per compute unit, then PAL would expose 40 instances on a 40CU Navi10. OpenCL would support 10 instances (2 CUs-per-WGP, 5 WGPs-per-SA), autosummed across shader arrays. SWDEV-189990: - Revert GFX9 and GFX10 tests back to using the MCVML2 counter it was using previously (prior to CL 1766829). This is counter index 2, which the test calls "BigK bank 0 hits". In the aforementioned change list, I updated the counter index from 2 to 14, since index 14 is the actual counter that represents "BigK bank 0 hits". Counter index 2 is the number of hits, not "bigK" hits. This previous change caused a test regression reported in SWDEV-189990. By reverting the code to use counter 2, the expected value in the test should be correct. Perhaps a better update would be to change the description in the source from "BigK bank 0 hits" to "bank 0 hits", but for now, I'm just going to go back to what the test was doing before. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcounters.cpp#21 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcounters.hpp#11 edit ... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/runtime/OCLPerfCounters.cpp#47 edit
134 lines
4.4 KiB
C++
134 lines
4.4 KiB
C++
//
|
|
// Copyright (c) 2015 Advanced Micro Devices, Inc. All rights reserved.
|
|
//
|
|
#pragma once
|
|
|
|
#include "top.hpp"
|
|
#include "device/device.hpp"
|
|
#include "device/pal/paldevice.hpp"
|
|
#include "palPerfExperiment.h"
|
|
|
|
namespace pal {
|
|
|
|
enum class PCIndexSelect : uint {
|
|
None = 0, ///< no index
|
|
Instance, ///< index by block instance -- (1 to 1 mapping with PAL)
|
|
ShaderEngine, ///< index by shader engine (sum = 1 value for all PAL Instances)
|
|
ShaderArray, ///< index by shader array (sum = 1 value for each shader array)
|
|
ComputeUnit, ///< index by compute unit
|
|
};
|
|
|
|
class VirtualGPU;
|
|
|
|
class PalCounterReference : public amd::ReferenceCountedObject {
|
|
public:
|
|
static PalCounterReference* Create(VirtualGPU& gpu);
|
|
|
|
//! Default constructor
|
|
PalCounterReference(VirtualGPU& gpu //!< Virtual GPU device object
|
|
)
|
|
: gpu_(gpu),
|
|
perfExp_(nullptr),
|
|
layout_(nullptr),
|
|
memory_(nullptr),
|
|
cpuAddr_(nullptr),
|
|
numExpCounters_(0) {}
|
|
|
|
//! Get PAL counter
|
|
Pal::IPerfExperiment* iPerf() const { return perfExp_; }
|
|
|
|
//! Returns the virtual GPU device
|
|
const VirtualGPU& gpu() const { return gpu_; }
|
|
|
|
//! Prepare for execution
|
|
bool finalize();
|
|
|
|
//! Returns the PAL counter results
|
|
uint64_t result(const std::vector<int>& index);
|
|
|
|
//! Get the latest Experiment Counter index
|
|
uint getPalCounterIndex() { return numExpCounters_++; };
|
|
|
|
protected:
|
|
//! Default destructor
|
|
~PalCounterReference();
|
|
|
|
private:
|
|
//! Disable copy constructor
|
|
PalCounterReference(const PalCounterReference&);
|
|
|
|
//! Disable operator=
|
|
PalCounterReference& operator=(const PalCounterReference&);
|
|
|
|
VirtualGPU& gpu_; //!< The virtual GPU device object
|
|
Pal::IPerfExperiment* perfExp_; //!< PAL performance experiment object
|
|
Pal::GlobalCounterLayout* layout_; //!< Layout of the result
|
|
Memory* memory_; //!< Memory used by PAL performance experiment
|
|
void* cpuAddr_; //!< CPU address of memory_
|
|
uint numExpCounters_; //!< Number of Experiment Counter created
|
|
};
|
|
|
|
//! Performance counter implementation on GPU
|
|
class PerfCounter : public device::PerfCounter {
|
|
public:
|
|
//! The performance counter info
|
|
struct Info : public amd::EmbeddedObject {
|
|
uint blockIndex_; //!< Index of the block to configure
|
|
uint counterIndex_; //!< Index of the hardware counter
|
|
uint eventIndex_; //!< Event you wish to count with the counter
|
|
PCIndexSelect indexSelect_; //!< IndexSelect type of the counter
|
|
};
|
|
|
|
//! Constructor for the GPU PerfCounter object
|
|
PerfCounter(const Device& device, //!< A GPU device object
|
|
PalCounterReference* palRef, //!< Counter Reference
|
|
cl_uint blockIndex, //!< HW block index
|
|
cl_uint counterIndex, //!< Counter index within the block
|
|
cl_uint eventIndex) //!< Event index for profiling
|
|
: gpuDevice_(device), palRef_(palRef) {
|
|
info_.blockIndex_ = blockIndex;
|
|
info_.counterIndex_ = counterIndex;
|
|
info_.eventIndex_ = eventIndex;
|
|
convertInfo();
|
|
}
|
|
|
|
//! Destructor for the GPU PerfCounter object
|
|
virtual ~PerfCounter();
|
|
|
|
//! Creates the current object
|
|
bool create();
|
|
|
|
//! Returns the specific information about the counter
|
|
uint64_t getInfo(uint64_t infoType //!< The type of returned information
|
|
) const;
|
|
|
|
//! Returns the GPU device, associated with the current object
|
|
const Device& dev() const { return gpuDevice_; }
|
|
|
|
//! Returns the virtual GPU device
|
|
const VirtualGPU& gpu() const { return palRef_->gpu(); }
|
|
|
|
//! Returns the PAL performance counter descriptor
|
|
const Info* info() const { return &info_; }
|
|
|
|
//! Returns the Info structure for performance counter
|
|
Pal::IPerfExperiment* iPerf() const { return palRef_->iPerf(); }
|
|
|
|
private:
|
|
//! Disable default copy constructor
|
|
PerfCounter(const PerfCounter&);
|
|
|
|
//! Disable default operator=
|
|
PerfCounter& operator=(const PerfCounter&);
|
|
|
|
//! Convert info from ORCA to PAL
|
|
void convertInfo();
|
|
|
|
const Device& gpuDevice_; //!< The backend device
|
|
PalCounterReference* palRef_; //!< Reference counter
|
|
Info info_; //!< The info structure for perfcounter
|
|
std::vector<int> index_; //!< Counter index in the PAL container
|
|
};
|
|
|
|
} // namespace pal
|