Skip to content

Commit a6191f1

Browse files
trbauersys_zuul
authored andcommitted
Internal feature
Change-Id: Ic188cb232524a750158e822a82f4a180c8eff347
1 parent dc86935 commit a6191f1

File tree

11 files changed

+106
-151
lines changed

11 files changed

+106
-151
lines changed
Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# GEDLibrary/GED
22
if(WIN32)
3-
cmake_minimum_required(VERSION 3.1)
3+
cmake_minimum_required(VERSION 3.1)
44
else()
5-
cmake_minimum_required(VERSION 2.8)
5+
cmake_minimum_required(VERSION 2.8)
66
endif(WIN32)
77

88
project(GEDLibrary)
99

1010
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
11-
set(PLATFORM_TARGET ia32)
12-
set(GED_TARGET TARGET_IA32)
11+
set(PLATFORM_TARGET ia32)
12+
set(GED_TARGET TARGET_IA32)
1313
else()
14-
set(PLATFORM_TARGET intel64)
15-
set(GED_TARGET TARGET_INTEL64)
14+
set(PLATFORM_TARGET intel64)
15+
set(GED_TARGET TARGET_INTEL64)
1616
endif()
1717

1818

@@ -23,24 +23,21 @@ add_subdirectory(build/autogen-${PLATFORM_TARGET})
2323

2424
# Set up windows mobile build flags to use dynamic multi-threaded runtime (/MD)
2525
# Set up windows(other) build flags to use static multi-threaded runtime (/MT)
26-
if( WIN32 AND ("${BUILD_WINDOWS_MOBILE}" STREQUAL "TRUE") OR (IGC_OPTION__WINDOWS_MOBILE AND LINK_DLL_IGA) )
27-
win_dynamic_runtime()
26+
if( WIN32 AND ("${BUILD_WINDOWS_MOBILE}" STREQUAL "TRUE") OR (IGC_OPTION__WINDOWS_MOBILE AND LINK_DLL_IGA))
27+
win_dynamic_runtime()
2828
else(WIN32 AND ("${BUILD_WINDOWS_MOBILE}" STREQUAL "TRUE") OR (IGC_OPTION__WINDOWS_MOBILE AND LINK_DLL_IGA))
29-
win_static_runtime()
29+
win_static_runtime()
3030
endif(WIN32 AND ("${BUILD_WINDOWS_MOBILE}" STREQUAL "TRUE") OR (IGC_OPTION__WINDOWS_MOBILE AND LINK_DLL_IGA))
3131

3232
set(GED_files
33-
${GED_xcoder_cpp}
34-
${GED_xcoder_h}
35-
${GED_common_cpp}
36-
${GED_common_h}
37-
${GED_autogen${PLATFORM_TARGET}_cpp}
38-
${GED_autogen${PLATFORM_TARGET}_h})
33+
${GED_xcoder_cpp}
34+
${GED_xcoder_h}
35+
${GED_common_cpp}
36+
${GED_common_h}
37+
${GED_autogen${PLATFORM_TARGET}_cpp}
38+
${GED_autogen${PLATFORM_TARGET}_h})
3939

4040
include_directories(Source/ged Source/common Source "build/autogen-${PLATFORM_TARGET}")
41-
if (NOT IGC_BUILD)
42-
set(GED_validation_api GED_VALIDATION_API)
43-
endif()
4441

4542
set(GED_definitions_hide_enums
4643
GED_MODELS_ARRAY_NAMES_HIDDEN
@@ -61,7 +58,6 @@ set(GED_definitions_hide_enums
6158
GED_DEP_CTRL_HIDDEN
6259
GED_DST_CHAN_EN_HIDDEN
6360
GED_EOT_HIDDEN
64-
GED_EVICT_HINT_HIDDEN
6561
GED_EXEC_MASK_OFFSET_CTRL_HIDDEN
6662
GED_EXECUTION_DATA_TYPE_HIDDEN
6763
GED_FUSION_CTRL_HIDDEN
@@ -81,7 +77,6 @@ set(GED_definitions_hide_enums
8177
GED_RETURN_DATA_CONTROL_HIDDEN
8278
GED_SATURATE_HIDDEN
8379
GED_SFID_HIDDEN
84-
GED_SHFL_FC_HIDDEN
8580
GED_SIMDMODE_HIDDEN
8681
GED_SLOT_GROUP_HIDDEN
8782
GED_SRC_MOD_HIDDEN
@@ -90,45 +85,45 @@ set(GED_definitions_hide_enums
9085
GED_SUB_FUNC_ID_HIDDEN
9186
GED_SWIZZLE_HIDDEN
9287
GED_SYNC_FC_HIDDEN
93-
GED_TERNARY_EVICT_HINT_HIDDEN
94-
GED_TERNARY_STORE_HINT_HIDDEN
9588
GED_THREAD_CTRL_HIDDEN)
96-
set(GED_definitions_debug _CONSOLE _LIB ${GED_TARGET} GED_DISASSEMBLY GED_DEBUG ${GED_validation_api} ${GED_definitions_hide_enums})
97-
set(GED_definitions _CONSOLE _LIB ${GED_TARGET} GED_DISASSEMBLY ${GED_validation_api} ${GED_definitions_hide_enums})
9889

99-
#Needs to be before add_library otherwise it doesn't get set.
90+
91+
set(GED_definitions_debug _CONSOLE _LIB ${GED_TARGET} GED_DISASSEMBLY ${GED_definitions_hide_enums} GED_DEBUG)
92+
set(GED_definitions _CONSOLE _LIB ${GED_TARGET} GED_DISASSEMBLY ${GED_definitions_hide_enums})
93+
94+
# Needs to be before add_library otherwise it doesn't get set.
10095
if(MSVC)
101-
add_compile_options($<$<CONFIG:Release>:/Ox> /Gy)
96+
add_compile_options($<$<CONFIG:Release>:/Ox> /Gy)
10297
endif(MSVC)
10398

10499
if (MSVC)
105-
set(IGA_LINK_FLAGS "/OPT:REF /OPT:ICF /LTCG /INCREMENTAL:NO")
100+
set(IGA_LINK_FLAGS "/OPT:REF /OPT:ICF /LTCG /INCREMENTAL:NO")
106101
else(MSVC)
107-
set(IGA_LINK_FLAGS "")
102+
set(IGA_LINK_FLAGS "")
108103
endif(MSVC)
109104

110105
add_library(GEDLibrary OBJECT ${GED_files})
111106

112-
set_property( TARGET GEDLibrary APPEND PROPERTY
107+
set_property(TARGET GEDLibrary APPEND PROPERTY
113108
OUTPUT_NAME "ged${TARGET_MODIFIER}"
114109
)
115-
set_property( TARGET GEDLibrary APPEND PROPERTY
110+
set_property(TARGET GEDLibrary APPEND PROPERTY
116111
COMPILE_DEFINITIONS ${GED_definitions}
117112
)
118-
set_property( TARGET GEDLibrary APPEND PROPERTY
113+
set_property(TARGET GEDLibrary APPEND PROPERTY
119114
COMPILE_DEFINITIONS $<$<CONFIG:Debug>:GED_DEBUG>
120115
)
121116

122117
# Hidden visibility suppresses PLT entries from being created for GED and
123118
# functions and trims the interface down to a minimal size
124119
# This was manifested when IGA was used in GT-PIN which also uses GED.
125120
# IGA ended up using GED library linked with GT-PIN not IGA one
126-
#https://gcc.gnu.org/wiki/Visibility
121+
# https://gcc.gnu.org/wiki/Visibility
127122
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
128123

129124
if(NOT WIN32)
130-
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden" )
131-
set_target_properties( GEDLibrary PROPERTIES PREFIX "")
125+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
126+
set_target_properties(GEDLibrary PROPERTIES PREFIX "")
132127
endif()
133128

134129
source_group("SourceFiles/xcoder" FILES ${GED_xcoder_cpp})
@@ -140,8 +135,8 @@ source_group("HeaderFiles/auto${PLATFORM_TARGET}" FILES ${GED_autogen${PLATFORM_
140135

141136
# target_include_directories(GEDLibrary PRIVATE include)
142137
if(ANDROID AND MEDIA_IGA)
143-
set(NDK_Libstdcxx $ENV{ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx)
144-
set(Extra_Android_Inc ${NDK_Libstdcxx}/include ${ANDROID_NDK}/sources/android/support/include
138+
set(NDK_Libstdcxx $ENV{ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx)
139+
set(Extra_Android_Inc ${NDK_Libstdcxx}/include ${ANDROID_NDK}/sources/android/support/include
145140
${NDK_Libstdcxx}/include/backward)
146-
include_directories(${Extra_Android_Inc})
141+
include_directories(${Extra_Android_Inc})
147142
endif(ANDROID AND MEDIA_IGA)

visa/iga/GEDLibrary/GED_external/build/autogen-ia32/ged_ins_field.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ GED_FIELD_TYPE fieldTypesByField[116] =
126126
0x100, // 114
127127
0x100 // 115
128128
}; // fieldTypesByField[]
129+
130+
#if GED_VALIDATION_API
129131
const char* fieldNameByField[116] =
130132
{
131133
"Opcode", // 0
@@ -245,6 +247,7 @@ const char* fieldNameByField[116] =
245247
"DataTypeIndexNoDep", // 114
246248
"CompactedImm" // 115
247249
}; // fieldNameByField[]
250+
#endif // GED_VALIDATION_API
248251
GED_FIELD_TYPE pseudoFieldTypesByField[36] =
249252
{
250253
0x103, // 0
@@ -284,6 +287,8 @@ GED_FIELD_TYPE pseudoFieldTypesByField[36] =
284287
0x103, // 34
285288
0x100 // 35
286289
}; // pseudoFieldTypesByField[]
290+
291+
#if GED_VALIDATION_API
287292
const char* fieldNameByPseudoField[36] =
288293
{
289294
"ArchReg", // 0
@@ -323,3 +328,4 @@ const char* fieldNameByPseudoField[36] =
323328
"MessageTypeDP_DCRO", // 34
324329
"ExMessageLength" // 35
325330
}; // fieldNameByPseudoField[]
331+
#endif // GED_VALIDATION_API
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
const char* gedVersion = "VERSION=dev (5d0e7cb)";
1+
const char* gedVersion = "VERSION=GED0.71 (4d64f1b)";

visa/iga/GEDLibrary/GED_external/build/autogen-intel64/ged_ins_field.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ GED_FIELD_TYPE fieldTypesByField[116] =
126126
0x100, // 114
127127
0x100 // 115
128128
}; // fieldTypesByField[]
129+
130+
#if GED_VALIDATION_API
129131
const char* fieldNameByField[116] =
130132
{
131133
"Opcode", // 0
@@ -245,6 +247,7 @@ const char* fieldNameByField[116] =
245247
"DataTypeIndexNoDep", // 114
246248
"CompactedImm" // 115
247249
}; // fieldNameByField[]
250+
#endif // GED_VALIDATION_API
248251
GED_FIELD_TYPE pseudoFieldTypesByField[36] =
249252
{
250253
0x103, // 0
@@ -284,6 +287,8 @@ GED_FIELD_TYPE pseudoFieldTypesByField[36] =
284287
0x103, // 34
285288
0x100 // 35
286289
}; // pseudoFieldTypesByField[]
290+
291+
#if GED_VALIDATION_API
287292
const char* fieldNameByPseudoField[36] =
288293
{
289294
"ArchReg", // 0
@@ -323,3 +328,4 @@ const char* fieldNameByPseudoField[36] =
323328
"MessageTypeDP_DCRO", // 34
324329
"ExMessageLength" // 35
325330
}; // fieldNameByPseudoField[]
331+
#endif // GED_VALIDATION_API
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
const char* gedVersion = "VERSION=dev (5d0e7cb)";
1+
const char* gedVersion = "VERSION=GED0.71 (4d64f1b)";

visa/iga/IGALibrary/Backend/GED/Decoder.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2727
#include "IGAToGEDTranslation.hpp"
2828
#include "GEDToIGATranslation.hpp"
2929
#include "../../asserts.hpp"
30+
#include "../../strings.hpp"
3031
#include "../../Frontend/Formatter.hpp"
3132
#include "../../Frontend/IRToString.hpp"
3233
#include "../../IR/Checker/IRChecker.hpp"
@@ -37,6 +38,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3738
#include <sstream>
3839
#include <cstring>
3940

41+
42+
4043
// Used to label expressions that need to be removed once GED is fixed
4144
#define GED_WORKAROUND(X) (X)
4245

visa/iga/IGALibrary/Backend/GED/Decoder.hpp

Lines changed: 34 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -30,53 +30,55 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3030
#include "GEDToIGATranslation.hpp"
3131
#include "ged.h"
3232

33+
#ifdef GED_PRINT_BIT_LOCATION
34+
#undef GED_PRINT_BIT_LOCATION
35+
#endif
36+
#if GED_VALIDATION_API
37+
#define GED_PRINT_BIT_LOCATION(FIELD) \
38+
do { \
39+
std::cout << "FIELD: " << #FIELD << "\n"; \
40+
GED_PrintFieldBitLocation(&m_currGedInst, GED_INS_FIELD_ ## FIELD); \
41+
} while(0)
42+
#else
43+
#define GED_PRINT_BIT_LOCATION(FIELD)
44+
#endif
3345

3446
#define GED_DECODE_TO(FIELD, TRANS, DST) \
3547
do { \
36-
GED_RETURN_VALUE _status; \
37-
if (print_ged_debug) { \
38-
std::cout << "FIELD: " << #FIELD << std::endl; \
39-
GED_PrintFieldBitLocation(&m_currGedInst, GED_INS_FIELD_ ## FIELD); \
40-
} \
41-
DST = TRANS(GED_Get ## FIELD(&m_currGedInst, &_status)); \
42-
if (_status != GED_RETURN_VALUE_SUCCESS) { \
43-
handleGedDecoderError(__LINE__, #FIELD, _status); \
44-
} \
48+
GED_RETURN_VALUE _status; \
49+
GED_PRINT_BIT_LOCATION(FIELD); \
50+
DST = TRANS(GED_Get ## FIELD(&m_currGedInst, &_status)); \
51+
if (_status != GED_RETURN_VALUE_SUCCESS) { \
52+
handleGedDecoderError(__LINE__, #FIELD, _status); \
53+
} \
4554
} while (0)
4655

4756
#define GED_DECODE_RAW_TO(FIELD, DST) \
4857
do { \
49-
GED_RETURN_VALUE _status; \
50-
if (print_ged_debug) { \
51-
std::cout << "FIELD: " << #FIELD << std::endl; \
52-
GED_PrintFieldBitLocation(&m_currGedInst, GED_INS_FIELD_ ## FIELD); \
53-
} \
54-
DST = GED_Get ## FIELD(&m_currGedInst, &_status); \
55-
if (_status != GED_RETURN_VALUE_SUCCESS) { \
56-
handleGedDecoderError(__LINE__, #FIELD, _status); \
57-
} \
58+
GED_RETURN_VALUE _status; \
59+
GED_PRINT_BIT_LOCATION(FIELD); \
60+
DST = GED_Get ## FIELD(&m_currGedInst, &_status); \
61+
if (_status != GED_RETURN_VALUE_SUCCESS) { \
62+
handleGedDecoderError(__LINE__, #FIELD, _status); \
63+
} \
5864
} while (0)
5965

6066
#define GED_DECODE_RAW(GED_TYPE, ID, FIELD) \
61-
GED_TYPE ID; \
62-
GED_DECODE_RAW_TO(FIELD, ID);
67+
GED_TYPE ID; \
68+
GED_DECODE_RAW_TO(FIELD, ID);
6369

6470
#define GED_DECODE(IGA_TYPE, GED_TYPE, ID, FIELD) \
65-
GED_DECODE_RAW(GED_TYPE, GED_ ## ID, FIELD); \
66-
IGA_TYPE ID = translate(GED_ ## ID);
67-
71+
GED_DECODE_RAW(GED_TYPE, GED_ ## ID, FIELD); \
72+
IGA_TYPE ID = translate(GED_ ## ID);
6873

6974
#define GED_DECODE_RAW_TO_SRC(DST, TYPE, FIELD) \
7075
do { \
71-
GED_RETURN_VALUE _STATUS; \
72-
if (print_ged_debug) { \
73-
std::cout << "FIELD: " << #FIELD << std::endl; \
74-
GED_PrintFieldBitLocation(&m_currGedInst, GED_INS_FIELD_ ## FIELD); \
75-
} \
76-
DST = GED_Get ## FIELD(&m_currGedInst, &_STATUS); \
77-
if (_STATUS != GED_RETURN_VALUE_SUCCESS) { \
78-
handleGedDecoderError(__LINE__, #FIELD, _STATUS); \
79-
} \
76+
GED_RETURN_VALUE _STATUS; \
77+
GED_PRINT_BIT_LOCATION(FIELD); \
78+
DST = GED_Get ## FIELD(&m_currGedInst, &_STATUS); \
79+
if (_STATUS != GED_RETURN_VALUE_SUCCESS) { \
80+
handleGedDecoderError(__LINE__, #FIELD, _STATUS); \
81+
} \
8082
} while (0)
8183

8284
#define RETURN_GED_DECODE_RAW_TO_SRC(TYPE, FIELD) { \
@@ -406,18 +408,6 @@ namespace iga
406408
void decodeChSelToSwizzle(uint32_t chanSel, GED_SWIZZLE swizzle[4]);
407409
template <SourceIndex S> bool isChanSelPacked();
408410

409-
#if GED_VALIDATION_API
410-
static const bool print_ged_debug = true;
411-
#else
412-
static const bool print_ged_debug = false;
413-
static GED_RETURN_VALUE GED_PrintFieldBitLocation(
414-
const ged_ins_t*,
415-
const GED_INS_FIELD)
416-
{
417-
return GED_RETURN_VALUE_SUCCESS;
418-
};
419-
#endif
420-
421411
void decodeOptions(Instruction *inst);
422412

423413
// Translate Sub register from binary encoding number to asm number

visa/iga/IGALibrary/Backend/GED/Encoder.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2323
2424
2525
======================= end_copyright_notice ==================================*/
26-
#include "IGAToGEDTranslation.hpp"
2726
#include "Encoder.hpp"
28-
#include "../../IR/Kernel.hpp"
27+
#include "IGAToGEDTranslation.hpp"
28+
#include "../../strings.hpp"
2929
#include "../../Frontend/IRToString.hpp"
30+
#include "../../IR/Kernel.hpp"
31+
#include "../../IR/SWSBSetter.hpp"
3032
#include "../../Models/Models.hpp"
3133
#include "../../Timer/Timer.hpp"
32-
#include "../../IR/SWSBSetter.hpp"
34+
3335
#include <cstring>
3436

3537
using namespace iga;
@@ -45,6 +47,7 @@ using namespace iga;
4547
// InstructionEncoder
4648

4749

50+
4851
static const char *gedReturnValueToString(GED_RETURN_VALUE rv)
4952
{
5053
switch(rv) {
@@ -184,8 +187,7 @@ void Encoder::encodeBlock(Block *blk)
184187

185188
GED_RETURN_VALUE status = GED_RETURN_VALUE_SIZE;
186189
bool mustCompact = inst->hasInstOpt(InstOpt::COMPACTED);
187-
bool mustNotCompact =
188-
inst->hasInstOpt(InstOpt::NOCOMPACT);
190+
bool mustNotCompact = inst->hasInstOpt(InstOpt::NOCOMPACT);
189191
int32_t iLen = 16;
190192
if (mustCompact || (!mustNotCompact && m_opts.autoCompact)) {
191193
// try compact first
@@ -205,7 +207,7 @@ void Encoder::encodeBlock(Block *blk)
205207
} // else: some other error (unreachable?)
206208
}
207209

208-
// try native encoding
210+
// try native encoding if compaction failed
209211
if (status != GED_RETURN_VALUE_SUCCESS) {
210212
inst->removeInstOpt(InstOpt::COMPACTED);
211213
status = GED_EncodeIns(&m_gedInst, GED_INS_TYPE_NATIVE, m_instBuf + currentPc());

0 commit comments

Comments
 (0)