Skip to content

Commit e1eab91

Browse files
committed
Copy GMD IDs correctly so that Workarounds get applied correctly
Copy GMD IDs correctly so that Workarounds get applied correctly
1 parent 89ad598 commit e1eab91

File tree

3 files changed

+47
-18
lines changed

3 files changed

+47
-18
lines changed

IGC/AdaptorOCL/ocl_igc_interface/impl/platform_impl.cpp

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,36 @@ namespace IGC {
1616
// Helpers for clarity
1717
// Basically, these forward GetX/SetX from interface (of given version)
1818
// to GT_SYSTEM_INFO inside pImpl
19-
// Prefix is used because members in platform are in hungarian notation
20-
#define DEFINE_GET_SET_PREFIX(INTERFACE, VERSION, NAME, TYPE, PREFIX)\
19+
//
20+
// DEFINE_GET_SET as defined in igc_features_and_workarounds_impl.cpp cannot
21+
// handle complex objects.
22+
#define DEFINE_GET_SET_COMPLEX(INTERFACE, VERSION, NAME, TYPE, SOURCE)\
2123
TYPE CIF_GET_INTERFACE_CLASS(INTERFACE, VERSION)::Get##NAME() const {\
22-
return static_cast<TYPE>(CIF_GET_PIMPL()->p.PREFIX##NAME);\
24+
return static_cast<TYPE>(CIF_GET_PIMPL()->p.SOURCE);\
2325
}\
2426
void CIF_GET_INTERFACE_CLASS(INTERFACE, VERSION)::Set##NAME(TYPE v) {\
25-
CIF_GET_PIMPL()->p.PREFIX##NAME = static_cast<decltype(CIF_GET_PIMPL()->p.PREFIX##NAME)>(v);\
27+
CIF_GET_PIMPL()->p.SOURCE = static_cast<decltype(CIF_GET_PIMPL()->p.SOURCE)>(v);\
2628
}
2729

28-
DEFINE_GET_SET_PREFIX(Platform, 1, ProductFamily, TypeErasedEnum, e);
29-
DEFINE_GET_SET_PREFIX(Platform, 1, PCHProductFamily, TypeErasedEnum, e);
30-
DEFINE_GET_SET_PREFIX(Platform, 1, DisplayCoreFamily, TypeErasedEnum, e);
31-
DEFINE_GET_SET_PREFIX(Platform, 1, RenderCoreFamily, TypeErasedEnum, e);
32-
DEFINE_GET_SET_PREFIX(Platform, 1, PlatformType, TypeErasedEnum, e);
33-
DEFINE_GET_SET_PREFIX(Platform, 1, DeviceID, unsigned short, us);
34-
DEFINE_GET_SET_PREFIX(Platform, 1, RevId, unsigned short, us);
35-
DEFINE_GET_SET_PREFIX(Platform, 1, DeviceID_PCH, unsigned short, us);
36-
DEFINE_GET_SET_PREFIX(Platform, 1, RevId_PCH, unsigned short, us);
37-
DEFINE_GET_SET_PREFIX(Platform, 1, GTType, TypeErasedEnum, e);
38-
30+
// Interface version 1.
31+
DEFINE_GET_SET_COMPLEX(Platform, 1, ProductFamily, TypeErasedEnum, eProductFamily);
32+
DEFINE_GET_SET_COMPLEX(Platform, 1, PCHProductFamily, TypeErasedEnum, ePCHProductFamily);
33+
DEFINE_GET_SET_COMPLEX(Platform, 1, DisplayCoreFamily, TypeErasedEnum, eDisplayCoreFamily);
34+
DEFINE_GET_SET_COMPLEX(Platform, 1, RenderCoreFamily, TypeErasedEnum, eRenderCoreFamily);
35+
DEFINE_GET_SET_COMPLEX(Platform, 1, PlatformType, TypeErasedEnum, ePlatformType);
36+
DEFINE_GET_SET_COMPLEX(Platform, 1, DeviceID, unsigned short, usDeviceID);
37+
DEFINE_GET_SET_COMPLEX(Platform, 1, RevId, unsigned short, usRevId);
38+
DEFINE_GET_SET_COMPLEX(Platform, 1, DeviceID_PCH, unsigned short, usDeviceID_PCH);
39+
DEFINE_GET_SET_COMPLEX(Platform, 1, RevId_PCH, unsigned short, usRevId_PCH);
40+
DEFINE_GET_SET_COMPLEX(Platform, 1, GTType, TypeErasedEnum, eGTType);
41+
42+
// Interface version 2.
43+
// Added Render/Media/Display block IDs
44+
DEFINE_GET_SET_COMPLEX(Platform, 2, RenderBlockID, unsigned int, sRenderBlockID.Value);
45+
DEFINE_GET_SET_COMPLEX(Platform, 2, MediaBlockID, unsigned int, sMediaBlockID.Value);
46+
DEFINE_GET_SET_COMPLEX(Platform, 2, DisplayBlockID, unsigned int, sDisplayBlockID.Value);
47+
48+
#undef DEFINE_GET_SET_COMPLEX
3949
}
4050

4151
#include "cif/macros/disable.h"

IGC/AdaptorOCL/ocl_igc_interface/platform.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,21 @@ CIF_DEFINE_INTERFACE_VER(Platform, 1){
5050
virtual void SetGTType(TypeErasedEnum v);
5151
};
5252

53+
CIF_DEFINE_INTERFACE_VER_WITH_COMPATIBILITY(Platform, 2, 1) {
54+
CIF_INHERIT_CONSTRUCTOR();
55+
56+
virtual void SetRenderBlockID(unsigned int v);
57+
virtual unsigned int GetRenderBlockID() const;
58+
virtual void SetDisplayBlockID(unsigned int v);
59+
virtual unsigned int GetDisplayBlockID() const;
60+
virtual void SetMediaBlockID(unsigned int v);
61+
virtual unsigned int GetMediaBlockID() const;
62+
};
63+
5364
CIF_GENERATE_VERSIONS_LIST(Platform);
5465
CIF_MARK_LATEST_VERSION(PlatformLatest, Platform);
55-
using PlatformTagOCL = PlatformLatest; // Note : can tag with different version for
56-
// transition periods
57-
66+
using PlatformTagOCL = Platform<1>; // Note : can tag with different version for
67+
// transition periods
5868
}
5969

6070
#include "cif/macros/disable.h"

IGC/AdaptorOCL/ocl_igc_interface/platform_helper.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ inline void PopulateInterfaceWith(IGC::Platform<Ver> &dst,
3434
COPY_VAL(RevId_PCH, usRevId_PCH);
3535
COPY_VAL_E(GTType);
3636
}
37+
38+
template <typename SrcStructT>
39+
inline void PopulateInterfaceWith(IGC::Platform<2>& dst,
40+
const SrcStructT& src) {
41+
PopulateInterfaceWith<1>(dst, src);
42+
COPY_VAL(RenderBlockID, sRenderBlockID.Value);
43+
COPY_VAL(MediaBlockID, sMediaBlockID.Value);
44+
COPY_VAL(DisplayBlockID, sDisplayBlockID.Value);
45+
}
3746
}
3847

3948
namespace GtSysInfoHelper {

0 commit comments

Comments
 (0)