Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions flang/lib/Semantics/check-cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ struct DeviceExprChecker
}
}
}
const Symbol &ultimate{sym->GetUltimate()};
const Scope &scope{ultimate.owner()};
const Symbol *mod{scope.IsModule() ? scope.symbol() : nullptr};
// Allow ieee_arithmetic module functions to be called on the device.
// TODO: Check for unsupported ieee_arithmetic on the device.
if (mod && mod->name() == "ieee_arithmetic") {
return {};
}
} else if (x.GetSpecificIntrinsic()) {
// TODO(CUDA): Check for unsupported intrinsics here
return {};
Expand Down
1 change: 1 addition & 0 deletions flang/module/ieee_arithmetic.f90
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ end subroutine ieee_get_underflow_mode_l##GKIND;
#define IEEE_IS_FINITE_R(XKIND) \
elemental logical function ieee_is_finite_a##XKIND(x); \
real(XKIND), intent(in) :: x; \
!dir$ ignore_tkr(d) x; \
end function ieee_is_finite_a##XKIND;
interface ieee_is_finite
SPECIFICS_R(IEEE_IS_FINITE_R)
Expand Down
12 changes: 12 additions & 0 deletions flang/test/Semantics/cuf09.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,15 @@ subroutine host1()
a(i) = a(i) + a(j) - 34.0
end do
end

subroutine ieee_test
use ieee_arithmetic

real(8), device :: y(100)
logical(4), managed :: ll(100)

!$cuf kernel do(1)<<<*,*>>>
do i = 1, 100
ll(i) = ieee_is_finite(y(i)) ! allow ieee_arithmetic functions on the device.
end do
end subroutine