Skip to content

Conversation

ProGTX
Copy link
Contributor

@ProGTX ProGTX commented Dec 21, 2023

A bunch of fixes to get -Werror builds to pass,
both on Linux and on Windows (/WX)

  • Disable verbose Windows warnings
    • _CRT_SECURE_NO_WARNINGS because of std::getenv
    • C4267 because of conversions from size_t to other integers
  • Define WIN32_LEAN_AND_MEAN and NOMINMAX on Windows
    • Gets rid of some errors and speeds up the build
  • Convert integer CUDA objects to std::uintptr_t
    before reinterpreting them to a pointer
  • Fixed "unused function" warning for GetHipFormatPixelSize
    • There was a lot of duplication, now a single function
      called imageElementByteSize
  • Mark some variables as potentially unused (only used in asserts)
  • Other minor fixes

@ProGTX ProGTX requested review from a team as code owners December 21, 2023 09:27
@ProGTX ProGTX requested a review from jchlanda December 21, 2023 09:27
Copy link
Contributor

@jchlanda jchlanda left a comment

Choose a reason for hiding this comment

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

CUDA/HIP 👍

@@ -502,3 +502,22 @@ struct ur_mem_handle_t_ {
}
}
};

constexpr size_t imageElementByteSize(hipArray_Format ArrayFormat) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be a fee floating function? Maybe we could hide it in the cpp file behind an anonymous namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function is used by two separate .cpp files, and used to be defined 3 times (with different names) in those two files, so I figured it'd be better to have a single definition. If that's not ideal because the function is now available in the entire adapter, what would be the preffered approach? Have two separate definitions of the function in anonymous namespace, or maybe a function that's defined in one .cpp file and externed in another?

Copy link
Contributor

@jchlanda jchlanda Dec 22, 2023

Choose a reason for hiding this comment

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

My bad, I only checked the diffs and it looked like it was only used in memory.cpp. I'd vote for one def + extern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Single def + extern in latest version

@codecov-commenter
Copy link

codecov-commenter commented Dec 21, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (42874bc) 15.73% compared to head (fbdb6a3) 15.73%.

Files Patch % Lines
test/conformance/source/environment.cpp 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1206      +/-   ##
==========================================
- Coverage   15.73%   15.73%   -0.01%     
==========================================
  Files         223      223              
  Lines       31478    31477       -1     
  Branches     3558     3558              
==========================================
- Hits         4954     4953       -1     
  Misses      26473    26473              
  Partials       51       51              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@PietroGhg PietroGhg left a comment

Choose a reason for hiding this comment

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

Native CPU LGTM, thank you

Copy link
Contributor

@pbalcer pbalcer left a comment

Choose a reason for hiding this comment

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

Our CI workflows use UR_DEVELOPER_MODE=ON, enforcing -Werror. Are you using a different compiler? Or are these issue related to configurations we don't build (e.g., non-L0 adapters on windows)?

If it's the latter, it might be useful to create an issue to add these missing configurations so that the build doesn't get broken again.

A bunch of fixes to get `-Werror` builds to pass,
both on Linux and on Windows (`/WX`)

* Disable verbose Windows warnings
  * `_CRT_SECURE_NO_WARNINGS` because of `std::getenv`
  * C4267 because of conversions from `size_t` to other integers
* Define `WIN32_LEAN_AND_MEAN` and `NOMINMAX` on Windows
  * Gets rid of some errors and speeds up the build
* Convert integer CUDA objects to std::uintptr_t
  before reinterpreting them to a pointer
* Fixed "unused function" warning for `GetHipFormatPixelSize`
  * There was a lot of duplication, now a single function
    called `imageElementByteSize`
* Mark some variables as potentially unused (only used in asserts)
* Other minor fixes
@ProGTX
Copy link
Contributor Author

ProGTX commented Jan 3, 2024

Our CI workflows use UR_DEVELOPER_MODE=ON, enforcing -Werror. Are you using a different compiler? Or are these issue related to configurations we don't build (e.g., non-L0 adapters on windows)?

If it's the latter, it might be useful to create an issue to add these missing configurations so that the build doesn't get broken again.

On Linux I built this with UR_BUILD_ADAPTER_ALL=ON, and on Windows I built CUDA, L0, and Native CPU. Which ones would need to be added to CI then?

Copy link
Contributor

@isaacault isaacault left a comment

Choose a reason for hiding this comment

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

Bindless images LGTM

@pbalcer
Copy link
Contributor

pbalcer commented Jan 9, 2024

Which ones would need to be added to CI then?

On Linux, we are missing a Native CPU build. On Windows, we are missing CUDA, HIP, OpenCL and Native CPU.

@kbenzie
Copy link
Contributor

kbenzie commented Jan 9, 2024

On Linux, we are missing a Native CPU build. On Windows, we are missing CUDA, HIP, OpenCL and Native CPU.

The HIP adapter is not supported on Windows currently, so doubt we need to add testing for it just now. We already have #1069 for native cpu testing on Linux.

@ProGTX
Copy link
Contributor Author

ProGTX commented Jan 10, 2024

Friendly ping for @oneapi-src/unified-runtime-level-zero-write

@kbenzie kbenzie added the ready to merge Added to PR's which are ready to merge label Jan 10, 2024
Copy link
Contributor

@nrspruit nrspruit left a comment

Choose a reason for hiding this comment

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

Good for the level zero side.

@kbenzie kbenzie merged commit c63ad9b into oneapi-src:main Jan 16, 2024
@ProGTX ProGTX deleted the peter/werror branch January 16, 2024 11:05
kbenzie added a commit to kbenzie/unified-runtime that referenced this pull request Jan 22, 2024
@kbenzie kbenzie mentioned this pull request Jan 22, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Added to PR's which are ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants