Page MenuHomePhabricator

[AMDGPU][ConstantFolding] Fold llvm.amdgcn.cube* intrinsics
ClosedPublic

Authored by foad on Feb 26 2020, 8:27 AM.

Details

Summary

This folds the following family of intrinsics:
llvm.amdgcn.cubeid (face id)
llvm.amdgcn.cubema (major axis)
llvm.amdgcn.cubesc (S coordinate)
llvm.amdgcn.cubetc (T coordinate)

Diff Detail

Unit TestsFailed

TimeTest
2,320 mslibc++.std/thread/thread_mutex/thread_mutex_requirements/thread_mutex_requirements_mutex/thread_mutex_class::Unknown Unit Message ("")
Compiled With: '/usr/bin/clang++ -o /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/projects/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/Output/try_lock.pass.cpp.o -x c++ /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/try_lock.pass.cpp -c -v -ftemplate-depth=270 -Werror=thread-safety -std=c++2a -include /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/libcxx/test/support/nasty_macros.h -nostdinc++ -I/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/libcxx/include -I/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/libcxx/test/support -DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/libcxx/test/std/input.output/filesystems/Inputs/static_test_env" -DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/projects/libcxx/test/filesystem/Output/dynamic_env" -DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/libcxx/test/support/filesystem_dynamic_test_helper.py" -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wall -Wextra -Werror -Wuser-defined-warnings -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -c && /usr/bin/clang++ -o /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/projects/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/Output/try_lock.pass.cpp.exe…

Event Timeline

foad created this revision.Feb 26 2020, 8:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2020, 8:27 AM
arsenm added inline comments.Feb 26 2020, 8:41 AM
llvm/lib/Analysis/ConstantFolding.cpp
2310

Using host FP operations is generally frowned on, and this should use APFloat

foad marked an inline comment as done.Feb 26 2020, 8:49 AM
foad added inline comments.
llvm/lib/Analysis/ConstantFolding.cpp
2310

OK, but the APFloat API is horrible to use for anything more complicated than + - * /.

foad updated this revision to Diff 246824.Feb 26 2020, 1:19 PM

Use APFloats.

arsenm added inline comments.Feb 26 2020, 1:53 PM
llvm/lib/Analysis/ConstantFolding.cpp
2311

const references

2317–2320

This can use const references and can be moved to a separate function since there's no local captures

2376–2378

Avoid the copy by sinking thees to the uses

foad updated this revision to Diff 246909.Feb 27 2020, 4:16 AM

Address review comments, rebase on D75237.

foad marked 5 inline comments as done.
foad added inline comments.
llvm/lib/Analysis/ConstantFolding.cpp
2317–2320

I moved it to APFloat::operator>= instead.

arsenm accepted this revision.Mar 4 2020, 3:54 PM

LGTM

This revision is now accepted and ready to land.Mar 4 2020, 3:54 PM
This revision was automatically updated to reflect the committed changes.
foad marked an inline comment as done.