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

PR #18407: Fix xla-mlir failures on Windows #19650

Merged
merged 1 commit into from
Nov 21, 2024
Merged

Conversation

copybara-service[bot]
Copy link

PR #18407: Fix xla-mlir failures on Windows

Imported from GitHub PR #18407

This PR aims to enable the XLA/mlir/tool test cases on the Windows Platform.

Error:
//xla/mlir/tools/mlir_bisect/... tests were failing on the Windows platform with the errors shown below:

Errors
Error 1.Error with llvm::seq
no matching function for call to 'seq'
for (auto i : llvm::seq(0ul, sizeof...(T))) {
Solution: change to llvm::seq(0, sizeof...(T))
By explicitly specifying the type (unsigned long) in llvm::seq, the compiler now clearly understands the type of the sequence.

Error 2. Missing dlfcn.h:
Location: xla/mlir/tools/mlir_interpreter/dialects/func.cc
fatal error: 'dlfcn.h' file not found
Solution: include 'windows.h' for Windows platform
Error 3.
Use of Undeclared Identifiers sym and RTLD_DEFAULT:
Location: xla/mlir/tools/mlir_interpreter/dialects/func.cc
use of undeclared identifier 'sym'
sym = dlsym(RTLD_DEFAULT, callee.getSymName().str().c_str());
^
use of undeclared identifier 'RTLD_DEFAULT'
Solution:
On Windows, the approach to obtaining a symbol's address differs from Unix-based systems.
GetModuleHandle function retrieves a handle to the specified module (DLL) that is loaded in the address space of the calling process. This handle is necessary to access the module's symbols.
GetProcAddress function locates the address of an exported function or variable by name.
Copybara import of the project:

--
1a42899 by Raunak [email protected]:

fix xla-mlir failures on windows

--
1500966 by Raunak [email protected]:

resolve comments

--
2483001 by Raunak [email protected]:

Keep the original file

--
4c7fe5e by Raunak [email protected]:

fix the formatting issue

--
270898a by mraunak [email protected]:

Update symbol_finder_windows.cc

6b63a30 by mraunak [email protected]:

Update symbol_finder_linux.cc

f0996fc by mraunak [email protected]:

Update symbol_finder.h

0c0c9bb by Raunak [email protected]:

Fix the build file

--
6d7f269 by Raunak [email protected]:

Resolve the comments

--
ef598af by Raunak [email protected]:

Resolve the comments

--
7131b8d by Raunak [email protected]:

added :find_symbol to dependency

--
64a6e9e by mraunak [email protected]:

Update BUILD

d47a8b2 by mraunak [email protected]:

Fix clang format

1a24df1 by Raunak [email protected]:

resolve the comments

--
12f69fc by Raunak [email protected]:

adding namespace and header style consistent

--
ec9b505 by Raunak [email protected]:

Fix the build file

Merging this change closes #18407

FUTURE_COPYBARA_INTEGRATE_REVIEW=#18407 from Intel-tensorflow:mraunak/xla-mlir ec9b505

Copy link

google-cla bot commented Nov 21, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@copybara-service copybara-service bot force-pushed the test_698388261 branch 4 times, most recently from 04ab1cc to d81f830 Compare November 21, 2024 14:20
Imported from GitHub PR #18407

This PR aims to enable the XLA/mlir/tool test cases on the Windows Platform.

Error:
//xla/mlir/tools/mlir_bisect/... tests were failing on the Windows platform with the errors shown below:

Errors
Error 1.Error with llvm::seq
no matching function for call to 'seq'
for (auto i : llvm::seq(0ul, sizeof...(T))) {
Solution: change to llvm::seq(0, sizeof...(T))
By explicitly specifying the type (unsigned long) in llvm::seq, the compiler now clearly understands the type of the sequence.

Error 2. Missing dlfcn.h:
Location: xla/mlir/tools/mlir_interpreter/dialects/func.cc
fatal error: 'dlfcn.h' file not found
Solution: include 'windows.h' for Windows platform
Error 3.
Use of Undeclared Identifiers sym and RTLD_DEFAULT:
Location: xla/mlir/tools/mlir_interpreter/dialects/func.cc
use of undeclared identifier 'sym'
sym = dlsym(RTLD_DEFAULT, callee.getSymName().str().c_str());
^
use of undeclared identifier 'RTLD_DEFAULT'
Solution:
On Windows, the approach to obtaining a symbol's address differs from Unix-based systems.
GetModuleHandle function retrieves a handle to the specified module (DLL) that is loaded in the address space of the calling process. This handle is necessary to access the module's symbols.
GetProcAddress function locates the address of an exported function or variable by name.
Copybara import of the project:

--
1a42899 by Raunak <[email protected]>:

fix xla-mlir failures on windows

--
1500966 by Raunak <[email protected]>:

resolve comments

--
2483001 by Raunak <[email protected]>:

Keep the original file

--
4c7fe5e by Raunak <[email protected]>:

fix the formatting issue

--
270898a by mraunak <[email protected]>:

Update symbol_finder_windows.cc
--
6b63a30 by mraunak <[email protected]>:

Update symbol_finder_linux.cc
--
f0996fc by mraunak <[email protected]>:

Update symbol_finder.h
--
0c0c9bb by Raunak <[email protected]>:

Fix the build file

--
6d7f269 by Raunak <[email protected]>:

Resolve the comments

--
ef598af by Raunak <[email protected]>:

Resolve the comments

--
7131b8d by Raunak <[email protected]>:

added :find_symbol to dependency

--
64a6e9e by mraunak <[email protected]>:

Update BUILD
--
d47a8b2 by mraunak <[email protected]>:

Fix clang format
--
1a24df1 by Raunak <[email protected]>:

resolve the comments

--
12f69fc by Raunak <[email protected]>:

adding namespace and header style consistent

--
ec9b505 by Raunak <[email protected]>:

Fix the build file

Merging this change closes #18407

COPYBARA_INTEGRATE_REVIEW=#18407 from Intel-tensorflow:mraunak/xla-mlir ec9b505
PiperOrigin-RevId: 698754912
@copybara-service copybara-service bot merged commit 60cb539 into main Nov 21, 2024
@copybara-service copybara-service bot deleted the test_698388261 branch November 21, 2024 14:22
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.

1 participant