Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Kokkos_ENABLE_CUDA_LDG_INTRINSIC option #5623

Merged
merged 6 commits into from
Nov 29, 2022

Conversation

masterleinad
Copy link
Contributor

Related to #5621. Since #2156, KOKKOS_ENABLE_CUDA_LDG_INTRINSIC is always enabled and, hence, CudaTextureFetch is unused.
This pull request proposes to eventually remove the option and CudaTextureFetch since it hasn't been used in more than 3 years.

Copy link
Member

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please discuss why it is OK to drop the KOKKOS_ENABLE_CUDA_LDG_INTRINSIC macro

@@ -77,6 +77,7 @@ KOKKOS_INTERNAL_DISABLE_COMPLEX_ALIGN := $(call kokkos_has_string,$(KOKKOS_OPTIO
KOKKOS_INTERNAL_DISABLE_DUALVIEW_MODIFY_CHECK := $(call kokkos_has_string,$(KOKKOS_OPTIONS),disable_dualview_modify_check)
KOKKOS_INTERNAL_ENABLE_PROFILING_LOAD_PRINT := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_profile_load_print)
KOKKOS_INTERNAL_ENABLE_LARGE_MEM_TESTS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_large_mem_tests)
# deprecated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that they are two other occurrences of us placing the # deprecated comment on the line before but I am wondering if there is any good reason not to place it at the end of the line that defines the variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it better visible to put it on a separate line (and that's also what #5608 does).

cmake/KokkosCore_config.h.in Show resolved Hide resolved
core/src/Cuda/Kokkos_Cuda_View.hpp Show resolved Hide resolved
BUILD.md Outdated
* Whether to use CUDA LDG intrinsics
* BOOL Default: OFF
* BOOL Default: ON
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we intentionally leave

KOKKOS_ENABLE_OPTION(CUDA_LDG_INTRINSIC OFF "Whether to use CUDA LDG intrinsics")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was assuming that people if at all set Kokkos_ENABLE_CUDA_LDG_INTRINSIC=ON and not Kokkos_ENABLE_CUDA_LDG_INTRINSIC=OFF explicitly. Hence, I would only warn/error out of people set it to ON (and that's why the "real" default should be OFF). Any better suggestions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option needs to only be defined if deprecated code 4 is ON. I am torn whether I would bother changing the documentation of what the default might be. I am leaning towards no.

@masterleinad
Copy link
Contributor Author

Please discuss why it is OK to drop the KOKKOS_ENABLE_CUDA_LDG_INTRINSIC macro

I reverted it for it always to be defined (but not used).

@dalg24
Copy link
Member

dalg24 commented Nov 8, 2022

Please discuss why it is OK to drop the KOKKOS_ENABLE_CUDA_LDG_INTRINSIC macro

I reverted it for it always to be defined (but not used).

Did you consider defining it only if deprecated code 4 is ON? How likely is it that this macro is being used downstream? Did you check in Trilinos? etc.

@masterleinad
Copy link
Contributor Author

Did you consider defining it only if deprecated code 4 is ON? How likely is it that this macro is being used downstream? Did you check in Trilinos? etc.

There really is no good reason why the macro would be used downstream, though; it should be purely internal. Trilinos doesn't use it (except for the bundled Kokkos of course). My initial instinct was to remove it because of that but that might be strong. There is also KOKKOS_OPT_RANGE_AGGRESSIVE_VECTORIZATION which we should have removed by now. In view of that, it might be best to remove it conditionally.

Anyway, the more important question is, of course, if we are OK with removing the option (and with it the CudaTextureFetch branch) in the first place.

@dalg24
Copy link
Member

dalg24 commented Nov 8, 2022

Anyway, the more important question is, of course, if we are OK with removing the option (and with it the CudaTextureFetch branch) in the first place.

I don't expect anyone is going to argue against removing an option for which we effectively ignore the value set by the user nor keep a dead branch in our code.

There really is no good reason why the macro would be used downstream, though; it should be purely internal. Trilinos doesn't use it (except for the bundled Kokkos of course). My initial instinct was to remove it because of that but that might be strong.

I tend to agree and don't expect one can do anything useful in user code based on whether that macro was defined or not. I would err on the side of caution and preserve the macro when deprecated code 4 is ON.

Comment on lines 58 to 61
#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
#define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC // deprecated
#endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Belongs to <Kokkos_Macros.hpp>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we only want to define it if CUDA is enabled.

BUILD.md Outdated
* Whether to use CUDA LDG intrinsics
* BOOL Default: OFF
* BOOL Default: ON
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option needs to only be defined if deprecated code 4 is ON. I am torn whether I would bother changing the documentation of what the default might be. I am leaning towards no.

@@ -141,3 +141,11 @@ ENDIF()
IF (KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE AND BUILD_SHARED_LIBS)
MESSAGE(FATAL_ERROR "Relocatable device code requires static libraries.")
ENDIF()

IF(KOKKOS_ENABLE_CUDA_LDG_INTRINSIC)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would do KOKKOS_ -> Kokkos_ here if the option is conditionally declared.

IF(KOKKOS_ENABLE_DEPRECATED_CODE_4)
MESSAGE(DEPRECATION "Setting Kokkos_ENABLE_CUDA_LDG_INTRINSIC is deprecated. LDG intrinsics are always enabled.")
ELSE()
MESSAGE(FATAL_ERROR "Kokkos_ENABLE_DEPRECATED_CODE_4 must be set to use Kokkos_ENABLE_CUDA_LDG_INTRINSIC")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MESSAGE(FATAL_ERROR "Kokkos_ENABLE_DEPRECATED_CODE_4 must be set to use Kokkos_ENABLE_CUDA_LDG_INTRINSIC")
MESSAGE(FATAL_ERROR "Kokkos_ENABLE_CUDA_LDG_INTRINSIC has been removed. LDG intrinsics are always enabled.")

@ajpowelsnl ajpowelsnl self-assigned this Nov 8, 2022
Copy link
Member

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please confirm that you meant to define the option regardless of whether deprecated code 4 is enabled or not

KOKKOS_ENABLE_OPTION(CUDA_LDG_INTRINSIC OFF "Whether to use CUDA LDG intrinsics")

Copy link
Member

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will merge as is and we will do a follow up if necessary

@dalg24 dalg24 merged commit d802fd0 into kokkos:develop Nov 29, 2022
@masterleinad masterleinad mentioned this pull request Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants