LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 51030 - SystemZ Backend: Add support for operations such as FP16_TO_FP and FP_TO_FP16
Summary: SystemZ Backend: Add support for operations such as FP16_TO_FP and FP_TO_FP16
Status: NEW
Alias: None
Product: new-bugs
Classification: Unclassified
Component: new bugs (show other bugs)
Version: unspecified
Hardware: Other Linux
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-08 10:03 PDT by Kun Lu
Modified: 2021-10-08 10:13 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kun Lu 2021-07-08 10:03:09 PDT
Hi, 

Recently we're running test suite of TensorFlow v2.5.0 on s390x (Ubuntu 18.04).  

Test case //tensorflow/compiler/tests:sort_ops_test_cpu fails due to the following error:

LLVM ERROR: Cannot select: 0x3ff14167ca0: f32 = fp16_to_fp 0x3ff14167f10
  0x3ff14167f10: i32,ch = load<(dereferenceable load 2 from %ir.4, !alias.scope !6, !noalias !4), zext from i16> 0x3ff14197548, 0x3ff141678f8, undef:i64
    0x3ff141678f8: i64,ch = load<(load 8 from %ir.3)> 0x3ff14197548, 0x3ff14167890, undef:i64
      0x3ff14167890: i64 = add nuw 0x3ff141674e8, Constant:i64<8>
        0x3ff141674e8: i64,ch = CopyFromReg 0x3ff14197548, Register:i64 %2
          0x3ff14167480: i64 = Register %2
        0x3ff14167828: i64 = Constant<8>
      0x3ff14167758: i64 = undef
    0x3ff14167758: i64 = undef
In function: compare_lt_WCTTAtafbb4__.7

Other test cases such as //tensorflow/python/keras/optimizer_v2:adam_test and //tensorflow/core/kernels/mlir_generated:abs_cpu_f16_f16_gen_test also fail on s390x due to similar reasons. A related issue (https://github.com/tensorflow/tensorflow/issues/44362) has been raised in TensorFlow GitHub issues.

We think the root cause is lack of support for operations such as FP16_TO_FP and FP_TO_FP16 which perform promotions and truncation for half-precision (16 bit) floating numbers in the SystemZ LLVM backend (llvm/lib/Target/SystemZ/SystemZISelLowering.cpp). Could these features be considered to add to SystemZ LLVM backend? Thanks!
Comment 1 Kun Lu 2021-09-21 07:06:40 PDT
Any updates from the community reg this issue? Thanks!
Comment 2 Mehdi Amini 2021-09-21 09:27:16 PDT
Moving out of MLIR: this is a backend issue.
Comment 3 Kun Lu 2021-10-08 10:13:26 PDT
It looks like commit https://reviews.llvm.org/rG8cd8120a7b5d which has been tagged as 13.0.0-rc could solve this issue, since it adds support for arch14 and operations related to FP16 conversion to the SystemZ backend. Could anyone from community help to confirm this? Thanks!