You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2020/06/01 22:05:00 UTC

[jira] [Commented] (IMPALA-9781) Fix GCC 7 runtime issue: Unaligned loads and stores for int128_t types

    [ https://issues.apache.org/jira/browse/IMPALA-9781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17121367#comment-17121367 ] 

ASF subversion and git services commented on IMPALA-9781:
---------------------------------------------------------

Commit b1883405cd59988b92df2799656666ff2f733c0e in impala's branch refs/heads/master from Joe McDonnell
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=b188340 ]

Reapply IMPALA-9781: Fix GCC 7 unaligned 128-bit loads / stores

When running a release binary built with GCC 7.5.0, it crashes
with an unaligned memory error in multiple pieces of code.
In these locations, we are doing stores to 128-bit values, but we
cannot guarantee alignment. GCC 7 must be optimizing the code to
use instructions that require a higher level of alignment than
we can provide.

This switches the code locations to use memcpy to avoid the
unaligned stores (with local variables as necessary).

Testing:
 - Ran exhaustive tests with a release binary built by GCC 7.5.0
 - Ran UBSAN core tests
 - Add unaligned test case in decimal-test

Change-Id: I7edd8beeb15e4fbb69126a9f97a1476a4b8f12a9
Reviewed-on: http://gerrit.cloudera.org:8080/16009
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Reviewed-by: Tim Armstrong <ta...@cloudera.com>


> Fix GCC 7 runtime issue: Unaligned loads and stores for int128_t types
> ----------------------------------------------------------------------
>
>                 Key: IMPALA-9781
>                 URL: https://issues.apache.org/jira/browse/IMPALA-9781
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Backend
>    Affects Versions: Impala 4.0
>            Reporter: Joe McDonnell
>            Assignee: Joe McDonnell
>            Priority: Major
>             Fix For: Impala 4.0
>
>
> When running with a release binary built with GCC 7, Impala crashes with multiple distinct unaligned memory errors. They are all related to manipulating 128-bit values. Presumably GCC 7 added an optimization to use an instruction that requires alignment for setting 128-bit values. The locations impacted are:
> SlotRef::GetDecimalValInterpreted():
>  
> {code:java}
>     case 16:
>       return DecimalVal(*reinterpret_cast<int128_t*>(t->GetSlot(slot_offset_)));
> {code}
> DecimalUtil::DecodeFromFixedLenByteArray():
>  
>  
> {code:java}
>   template<typename T>
>   static inline void DecodeFromFixedLenByteArray(
>       const uint8_t* buffer, int fixed_len_size, T* v) {
> ...
>     *v = 0; <--- unaligned store
> {code}
> DictDecoder::GetValue():
> {code:java}
>   virtual void GetValue(int index, void* buffer) {
>     T* val_ptr = reinterpret_cast<T*>(buffer);
>     ...
>     *val_ptr = dict_[index]; <--- unaligned store
>   }
> {code}
> These can be converted to use memcpy / memset to avoid the unaligned stores/loads.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org