Skip to content

Commit

Permalink
Update PAL from commit: 302d6d4
Browse files Browse the repository at this point in the history
* Add recommended heap in Pal::DeviceProperties to client for each engine for best performance
* Add Util::ArrayLen, a constexpr function to get the length of an array at compile time. This is meant to be used in place of "sizeof(foo) / sizeof(foo[0])"
* Remove asserts that fire on images that aren't render targets
* WriteEventCmd should translate HwPipePostIndexFetch to WRITE_DATA on ME engine
* Add implmentations for ComputeResults for StreamoutStats queries
  • Loading branch information
JacobHeAMD committed Jun 1, 2018
1 parent ca20734 commit a8ec658
Show file tree
Hide file tree
Showing 109 changed files with 72,628 additions and 76,959 deletions.
1 change: 1 addition & 0 deletions inc/core/palCmdBuffer.h
Expand Up @@ -35,6 +35,7 @@
#include "palDevice.h"
#include "palImage.h"
#include "palMsaaState.h"
#include "palPipeline.h"
#include "palQueryPool.h"

/// HSA kernel dispatch packet typedef
Expand Down
22 changes: 18 additions & 4 deletions inc/core/palDevice.h
Expand Up @@ -35,9 +35,10 @@
#include "palImage.h"
#include "palInlineFuncs.h"
#include "palPerfExperiment.h"
#include "palShader.h"
#include "palPipeline.h"
#include "palQueue.h"
#include "palFence.h"
#include "palCmdAllocator.h"

namespace Pal
{
Expand Down Expand Up @@ -107,9 +108,6 @@ enum class VaRange : uint32;
/// Maximum string length for GPU names. @see DeviceProperties.
constexpr uint32 MaxDeviceName = 256;

/// Maximum number of viewports.
constexpr uint32 MaxViewports = 16;

/// Maximum number of indirect user-data tables managed by PAL's command buffer objects. @see DeviceFinalizeInfo.
constexpr uint32 MaxIndirectUserDataTables = 3;

Expand Down Expand Up @@ -792,6 +790,12 @@ struct DeviceProperties
/// engine type.
uint32 gdsSizePerEngine; ///< Maximum GDS size in bytes available for a single engine.
uint32 maxNumDedicatedCu; ///< The maximum number of dedicated CUs for the real time audio queue

/// Specifies the suggested heap preference clients should use when creating an @ref ICmdAllocator that will
/// allocate command space for this engine type. These heap preferences should be specified in the allocHeap
/// parameter of @ref CmdAllocatorCreateInfo. Clients are free to ignore these defaults and use their own
/// heap preferences, but may suffer a performance penalty.
GpuHeap preferredCmdAllocHeaps[CmdAllocatorTypeCount];
} engineProperties[EngineTypeCount]; ///< Lists available engines on this device and their properties.

struct
Expand Down Expand Up @@ -4255,6 +4259,16 @@ class IDevice
virtual Result GetChillGlobalEnable(
bool* pGlobalEnable) = 0;

/// Update Chill Status (last active time stamp). After every frame, UMD needs to generate a time stamp and inform
/// KMD through the shared memory, if the time stamp changes between 2 frames, it means Chill is active and KMD
/// needs to adjust power through PSM.
///
/// @param [in] lastChillActiveTimeStampUs the last Chill active time stamp in microseconds to set
///
/// @returns Success if the call succeeded.
virtual Result UpdateChillStatus(
uint64 lastChillActiveTimeStampUs) = 0;

/// Make the Bus Addressable allocations available to be accessed by remote device.
/// Exposes the surface and marker bus addresses for each allocation. These bus addresses can be accessed by
/// calling @ref IGpuMemory::Desc() on the appropriate object.
Expand Down
8 changes: 2 additions & 6 deletions inc/core/palLib.h
Expand Up @@ -43,7 +43,7 @@
/// compatible, it is not assumed that the client will initialize all input structs to 0.
///
/// @ingroup LibInit
#define PAL_INTERFACE_MAJOR_VERSION 406
#define PAL_INTERFACE_MAJOR_VERSION 408

/// Minor interface version. Note that the interface version is distinct from the PAL version itself, which is returned
/// in @ref Pal::PlatformProperties.
Expand All @@ -53,7 +53,7 @@
/// of the existing enum values will change. This number will be reset to 0 when the major version is incremented.
///
/// @ingroup LibInit
#define PAL_INTERFACE_MINOR_VERSION 0
#define PAL_INTERFACE_MINOR_VERSION 1

/// Minimum major interface version. This is the minimum interface version PAL supports in order to support backward
/// compatibility. When it is equal to PAL_INTERFACE_MAJOR_VERSION, only the latest interface version is supported.
Expand Down Expand Up @@ -329,10 +329,6 @@ Result PAL_STDCALL EnumerateNullDevices(
* build. Clients should only change this to zero if they are using something besides SCPC for compiling their
* pipeline binaries.
*
* __PAL_ENABLE_INTERNAL_SCPC__: Defaults to 1. Controls whether or not a PAL IDevice object will manage an
* internal instance of an SCPC ICompiler object for compiling pipelines. If this is 1, then @ref PAL_BUILD_SCPC
* is overridden to be 1 as well.
*
* ### External Shader Compiler
* PAL must be linked with an SC library built by the client. The client must specify the location of the SC interface
* header files with this build parameter:
Expand Down
59 changes: 52 additions & 7 deletions inc/core/palPipeline.h
Expand Up @@ -32,10 +32,8 @@
#pragma once

#include "pal.h"
#include "palDevice.h"
#include "palGpuMemoryBindable.h"
#include "palImage.h"
#include "palShader.h"

namespace Util
{
Expand All @@ -53,6 +51,55 @@ namespace Pal
struct GpuMemSubAllocInfo;
enum class PrimitiveTopology : uint32;

/// ShaderHash represents a 128-bit shader hash.
struct ShaderHash
{
uint64 lower; ///< Lower 64-bits of hash
uint64 upper; ///< Upper 64-bits of hash
};

/// Determines whether two ShaderHashes are equal.
///
/// @param [in] hash1 The first 128-bit shader hash
/// @param [in] hash2 The second 128-bit shader hash
///
/// @returns True if the shader hashes are equal.
PAL_INLINE bool ShaderHashesEqual(
const ShaderHash hash1,
const ShaderHash hash2)
{
return ((hash1.lower == hash2.lower) & (hash1.upper == hash2.upper));
}

/// Determines whether the given ShaderHash is non-zero.
///
/// @param [in] hash A 128-bit shader hash
///
/// @returns True if the shader hash is non-zero.
PAL_INLINE bool ShaderHashIsNonzero(
const ShaderHash hash)
{
return ((hash.upper | hash.lower) != 0);
}

/// Specifies a shader type (i.e., what stage of the pipeline this shader was written for).
enum class ShaderType : uint32
{
Compute = 0,
Vertex,
Hull,
Domain,
Geometry,
Pixel,
};

/// Number of shader program types supported by PAL.
constexpr uint32 NumShaderTypes =
(1u + static_cast<uint32>(ShaderType::Pixel) - static_cast<uint32>(ShaderType::Compute));

/// Maximum number of viewports.
constexpr uint32 MaxViewports = 16;

/// Maximum number of supported stream-output declaration entries by any PAL device.
constexpr uint32 MaxStreamOutEntries = 512;

Expand Down Expand Up @@ -136,10 +183,10 @@ union PipelineCreateFlags
{
struct
{
uint32 clientInternal : 1;
uint32 reserved : 31;
uint32 clientInternal : 1; ///< Internal pipeline not created by the application.
uint32 reserved : 31; ///< Reserved for future use.
};
uint32 u32All; ///< Flags packed as 32-bit uint.
uint32 u32All; ///< Flags packed as 32-bit uint.
};

/// Constant definining the max number of view instance count that is supported.
Expand Down Expand Up @@ -167,7 +214,6 @@ struct ComputePipelineCreateInfo
/// interface. The Pipeline ELF contains pre-compiled shaders,
/// register values, and additional metadata.
size_t pipelineBinarySize; ///< Size of Pipeline ELF binary in bytes.

};

/// Specifies properties for creation of a graphics @ref IPipeline object. Input structure to
Expand Down Expand Up @@ -383,7 +429,6 @@ struct ShaderStats
class IPipeline : public IDestroyable
{
public:

/// Returns PAL-computed properties of this pipeline and its corresponding shaders.
///
/// @returns Property structure describing this pipeline.
Expand Down
17 changes: 17 additions & 0 deletions inc/core/palPipelineAbi.h
Expand Up @@ -83,6 +83,14 @@ static const char* PipelineAbiSymbolNameStrings[] =
"_amdgpu_vs_disasm",
"_amdgpu_ps_disasm",
"_amdgpu_cs_disasm",
"_amdgpu_ls_shdr_intrl_data",
"_amdgpu_hs_shdr_intrl_data",
"_amdgpu_es_shdr_intrl_data",
"_amdgpu_gs_shdr_intrl_data",
"_amdgpu_vs_shdr_intrl_data",
"_amdgpu_ps_shdr_intrl_data",
"_amdgpu_cs_shdr_intrl_data",
"_amdgpu_pipeline_intrl_data",
};

/// String table of the Pipeline Metadata names.
Expand Down Expand Up @@ -270,11 +278,20 @@ enum class PipelineSymbolType : uint32
VsDisassembly, ///< Hardware VS disassembly. Optional. Associated with the .AMDGPU.disasm section.
PsDisassembly, ///< Hardware PS disassembly. Optional. Associated with the .AMDGPU.disasm section.
CsDisassembly, ///< Hardware CS disassembly. Optional. Associated with the .AMDGPU.disasm section.
LsShdrIntrlData, ///< LS shader internal data pointer. Optional.
HsShdrIntrlData, ///< HS shader internal data pointer. Optional.
EsShdrIntrlData, ///< ES shader internal data pointer. Optional.
GsShdrIntrlData, ///< GS shader internal data pointer. Optional.
VsShdrIntrlData, ///< VS shader internal data pointer. Optional.
PsShdrIntrlData, ///< PS shader internal data pointer. Optional.
CsShdrIntrlData, ///< CS shader internal data pointer. Optional.
PipelineIntrlData, ///< Cross-shader internal data pointer. Optional.
Count,

ShaderMainEntry = LsMainEntry, ///< Shorthand for the first shader's entry point
ShaderIntrlTblPtr = LsShdrIntrlTblPtr, ///< Shorthand for the first shader's internal table pointer
ShaderDisassembly = LsDisassembly, ///< Shorthand for the first shader's disassembly string
ShaderIntrlData = LsShdrIntrlData, ///< Shorthand for the first shader's internal data pointer
};

static_assert(static_cast<uint32>(PipelineSymbolType::Count) == sizeof(PipelineAbiSymbolNameStrings)/sizeof(char*),
Expand Down
65 changes: 10 additions & 55 deletions inc/core/palShader.h
Expand Up @@ -30,61 +30,16 @@
*/

#pragma once

#include "pal.h"
#include "palDestroyable.h"

#include "palPipeline.h"

#if PAL_CLIENT_INTERFACE_MAJOR_VERSION >= 408
/// Starting with interface 408.0, it is an error to include palShader.h because we want to remove it. This file will
/// be removed once interfaces older than 408.0 are no longer supported by PAL.
#error "Fatal error! palShader.h is deprecated and the client is still including it."
#else
#if !defined(PAL_SUPPORTED_IL_MAJOR_VERSION)
/// The major version of AMD IL that PAL can parse correctly. Shaders compiled with a larger major version may not be
/// parsed appropriately.
#define PAL_SUPPORTED_IL_MAJOR_VERSION 2

namespace Pal
{

/// ShaderHash represents a 128-bit shader hash.
struct ShaderHash
{
uint64 lower; ///< Lower 64-bits of hash
uint64 upper; ///< Upper 64-bits of hash
};

/// Determines whether two ShaderHashes are equal.
///
/// @param [in] hash1 The first 128-bit shader hash
/// @param [in] hash2 The second 128-bit shader hash
///
/// @returns True if the shader hashes are equal.
PAL_INLINE bool ShaderHashesEqual(
const ShaderHash hash1,
const ShaderHash hash2)
{
return ((hash1.lower == hash2.lower) & (hash1.upper == hash2.upper));
}

/// Determines whether the given ShaderHash is non-zero.
///
/// @param [in] hash A 128-bit shader hash
///
/// @returns True if the shader hash is non-zero.
PAL_INLINE bool ShaderHashIsNonzero(
const ShaderHash hash)
{
return ((hash.upper | hash.lower) != 0);
}

/// Specifies a shader type (i.e., what stage of the pipeline this shader was written for).
enum class ShaderType : uint32
{
Compute = 0,
Vertex,
Hull,
Domain,
Geometry,
Pixel,
};

/// Number of shader program types supported by PAL.
constexpr uint32 NumShaderTypes =
(1u + static_cast<uint32>(ShaderType::Pixel) - static_cast<uint32>(ShaderType::Compute));

} // Pal
#endif
#endif
6 changes: 6 additions & 0 deletions inc/core/palShaderCache.h
Expand Up @@ -30,3 +30,9 @@
*/

#pragma once

#if PAL_CLIENT_INTERFACE_MAJOR_VERSION >= 408
/// Starting with interface 408.0, it is an error to include palShaderCache.h because we want to remove it. This file
/// will be removed once interfaces older than 408.0 are no longer supported by PAL.
#error "Fatal error! palShaderCache.h is deprecated and the client is still including it."
#endif

0 comments on commit a8ec658

Please sign in to comment.