diff options
author | Yang Rong <rong.r.yang@intel.com> | 2016-06-06 17:48:32 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2016-06-23 15:46:06 +0800 |
commit | 6d709e176d3bbec51a5ad4f0b61e5adf00af95a4 (patch) | |
tree | e7c9b837632e697b108a3182119d0baac7524895 /src | |
parent | 1b3b8f1bc5cef54da4ba8cfae99656891b283b10 (diff) |
GBE: warning when the GEN binary version mismatch.
GENC is indicate the binary type, so use the first byte of GEN binary
as binary version, if mismatch, output a warning.
Signed-off-by: Yang Rong <rong.r.yang@intel.com>
Reviewed-by: Ruiling Song <ruiling.song@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/cl_program.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/cl_program.c b/src/cl_program.c index 75262dba..644856c9 100644 --- a/src/cl_program.c +++ b/src/cl_program.c @@ -187,7 +187,7 @@ static const unsigned char binary_type_header[BHI_MAX][BINARY_HEADER_LENGTH]= \ {{'B','C', 0xC0, 0xDE}, {1, 'B', 'C', 0xC0, 0xDE}, {2, 'B', 'C', 0xC0, 0xDE}, - {0, 'G','E', 'N', 'C'}, + {1, 'G','E', 'N', 'C'}, {'C','I', 'S', 'A'}, }; @@ -196,10 +196,18 @@ LOCAL cl_bool headerCompare(const unsigned char *BufPtr, BINARY_HEADER_INDEX ind bool matched = true; int length = (index == BHI_SPIR || index == BHI_CMRT) ? BINARY_HEADER_LENGTH -1 :BINARY_HEADER_LENGTH; int i = 0; - for (i = 0; i < length; ++i) + if(index == BHI_GEN_BINARY) + i = 1; + for (; i < length; ++i) { matched = matched && (BufPtr[i] == binary_type_header[index][i]); } + if(index == BHI_GEN_BINARY && matched) { + if(BufPtr[0] != binary_type_header[index][0]) { + DEBUGP(DL_WARNING, "Beignet binary format have been changed, please generate binary again.\n"); + matched = false; + } + } return matched; } |