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

Removal of Pointless References in Function Args #946

Merged
merged 13 commits into from
Oct 26, 2022
Merged

Conversation

mondus
Copy link
Member

@mondus mondus commented Oct 25, 2022

Fixes #825

Data types fixed

  • unsigned int
  • int
  • bool
  • char
  • unsigned char
  • size_type (unsigned int)
  • float
  • double
  • signed char (we have some use of this)
  • EnvironmentManager::size_type
  • uint64_t
  • int64_t
  • uint16_t
  • int16_t
  • T
  • T2 (from use in macro properties)
  • cudaStream_t
  • size_t

Each items has been searched for using const type & as well as const type& as linting allows either.

Where const references appear in declarations they have been made primitive (pass by value) type argument and const has been removed as it is meaningless. Within definitions const primitive types are allowed as this signals an intention that the argument should not be changed in the function body.

@mondus mondus marked this pull request as draft October 25, 2022 16:35
@mondus
Copy link
Member Author

mondus commented Oct 25, 2022

There are actually quite a few places inside curve and message iterator functions where this might save a few registers.

@Robadob
Copy link
Member

Robadob commented Oct 25, 2022

There are actually quite a few places inside curve and message iterator functions where this might save a few registers.

Much of the device API stuff is marked inline/forceinline. So if it is actually being inlined, the function calls are presumably irrelevant.

@mondus
Copy link
Member Author

mondus commented Oct 25, 2022

Template types have also been modified to be passed by value. This may be detrimental if we decide to support complex types in the future although (as Rob has pointed out) most of the device functions are inlined so copies wouldn't need to be made for function calls. All C++ tests pass Python tests not run due to #939.

@mondus mondus marked this pull request as ready for review October 25, 2022 19:26
@mondus mondus requested a review from Robadob October 26, 2022 07:59
@Robadob
Copy link
Member

Robadob commented Oct 26, 2022

Windows/Release/SEATBELTS=ON tests pass. I need to look through the code changes before I put a review in though.

Copy link
Member

@Robadob Robadob left a comment

Choose a reason for hiding this comment

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

Looked through all the changes, added a bunch of suggestions where I think you made mistakes. However, given the length of changes my eyes may have glazed over and missed some.

Doesn't appear you changed any non-const references, which is where I was worried issues may occur.

Additionally you should probably do:
cudaStream_t doesn't need to be a reference, it's merely a typedef for a ptr
size_t too (CUDAScatter.cuh:243)

@ptheywood
Copy link
Member

ptheywood commented Oct 26, 2022

Tests all pased for a debug build under linux (C++ and python). I won't do a full review right now, but will take a look when Rob's suggestions have been resolved to see if any bits still jump out.


It's possible to run the python tests as long as you do it one folder at a time, which somehow avoids the gc related issues (usually)

@mondus
Copy link
Member Author

mondus commented Oct 26, 2022

Looked through all the changes, added a bunch of suggestions where I think you made mistakes. However, given the length of changes my eyes may have glazed over and missed some.

Doesn't appear you changed any non-const references, which is where I was worried issues may occur.

Additionally you should probably do: cudaStream_t doesn't need to be a reference, it's merely a typedef for a ptr size_t too (CUDAScatter.cuh:243)

Additional types added. Tests passing with SEATBELTS.

@mondus mondus requested a review from Robadob October 26, 2022 12:43
mondus and others added 11 commits October 26, 2022 15:12
Co-authored-by: Robert Chisholm <r.chisholm@sheffield.ac.uk>
Co-authored-by: Robert Chisholm <r.chisholm@sheffield.ac.uk>
Co-authored-by: Robert Chisholm <r.chisholm@sheffield.ac.uk>
Co-authored-by: Robert Chisholm <r.chisholm@sheffield.ac.uk>
Co-authored-by: Robert Chisholm <r.chisholm@sheffield.ac.uk>
Co-authored-by: Robert Chisholm <r.chisholm@sheffield.ac.uk>
Co-authored-by: Robert Chisholm <r.chisholm@sheffield.ac.uk>
mondus and others added 2 commits October 26, 2022 15:12
Co-authored-by: Robert Chisholm <r.chisholm@sheffield.ac.uk>
@Robadob Robadob merged commit 891e16d into master Oct 26, 2022
@Robadob Robadob deleted the reference_args branch October 26, 2022 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove pointless references in function args
3 participants