-
Notifications
You must be signed in to change notification settings - Fork 319
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
Support building against llvm15 #1035
Changes from 10 commits
2a0f69b
d6957e1
36ae6cd
34406e8
6206a41
247fa16
64bb499
bec8eec
a585985
cdd4c5f
2d5d8ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,23 @@ | ||
|
||
call activate %CONDA_ENV% | ||
|
||
@rem LLVM derives the location of diaguids.lib from the build-time environment. | ||
@rem Conda-forge packaging works around this by substituting the build-time | ||
@rem location of Visual Studio with $ENV{VSINSTALLDIR}. In order to ensure that | ||
@rem this environment variable is set appropriately, we activate the Visual | ||
@rem Studio Developer Command Prompt prior to running setup.py | ||
@rem | ||
@rem This workaround is required whilst using LLVM from conda-forge; it may also | ||
@rem be necessary to consider a workaround for our own llvmdev packages. | ||
@rem | ||
@rem For more info, see: | ||
@rem | ||
@rem - https://github.com/conda-forge/llvmdev-feedstock/issues/175 | ||
@rem - https://github.com/conda-forge/llvmdev-feedstock/pull/223 | ||
@rem - https://github.com/MicrosoftDocs/visualstudio-docs/issues/7774 | ||
if "%LLVM%"=="15" ( | ||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" | ||
if %errorlevel% neq 0 exit /b %errorlevel% | ||
) | ||
|
||
python setup.py build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
@rem The cmd /C hack circumvents a regression where conda installs a conda.bat | ||
@rem script in non-root environments. | ||
set CONDA_INSTALL=cmd /C conda install -q -y | ||
set PIP_INSTALL=pip install -q | ||
|
||
@echo on | ||
|
||
@rem Deactivate any environment | ||
call deactivate | ||
@rem Display root environment (for debugging) | ||
conda list | ||
call conda list | ||
|
||
@rem Clean up any left-over from a previous build | ||
conda remove --all -q -y -n %CONDA_ENV% | ||
call conda remove --all -q -y -n %CONDA_ENV% | ||
|
||
@rem Create and populate environment | ||
conda create -n %CONDA_ENV% -q -y python=%PYTHON% cmake | ||
call conda create -n %CONDA_ENV% -q -y python=%PYTHON% cmake | ||
if %errorlevel% neq 0 exit /b %errorlevel% | ||
|
||
call activate %CONDA_ENV% | ||
if %errorlevel% neq 0 exit /b %errorlevel% | ||
|
||
@rem Install llvmdev | ||
%CONDA_INSTALL% -c numba/label/dev llvmdev="14.*" | ||
if "%LLVM%"=="15" ( | ||
set LLVMDEV_CHANNEL="conda-forge" | ||
) else ( | ||
set LLVMDEV_CHANNEL="numba/label/dev" | ||
) | ||
|
||
call conda install -y -q -c %LLVMDEV_CHANNEL% llvmdev="%LLVM%" libxml2 | ||
if %errorlevel% neq 0 exit /b %errorlevel% |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,8 +161,13 @@ LLVMPY_AddCallGraphDOTPrinterPass(LLVMPassManagerRef PM) { | |
|
||
API_EXPORT(void) | ||
LLVMPY_AddDotDomPrinterPass(LLVMPassManagerRef PM, bool showBody) { | ||
#if LLVM_VERSION_MAJOR <= 14 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest being consistent with the #ifs, either all "<= 14" or all "< 15" |
||
unwrap(PM)->add(showBody ? llvm::createDomPrinterPass() | ||
: llvm::createDomOnlyPrinterPass()); | ||
#else | ||
unwrap(PM)->add(showBody ? llvm::createDomPrinterWrapperPassPass() | ||
: llvm::createDomOnlyPrinterWrapperPassPass()); | ||
#endif | ||
} | ||
|
||
API_EXPORT(void) | ||
|
@@ -172,8 +177,13 @@ LLVMPY_AddGlobalsModRefAAPass(LLVMPassManagerRef PM) { | |
|
||
API_EXPORT(void) | ||
LLVMPY_AddDotPostDomPrinterPass(LLVMPassManagerRef PM, bool showBody) { | ||
#if LLVM_VERSION_MAJOR <= 14 | ||
unwrap(PM)->add(showBody ? llvm::createPostDomPrinterPass() | ||
: llvm::createPostDomOnlyPrinterPass()); | ||
#else | ||
unwrap(PM)->add(showBody ? llvm::createPostDomPrinterWrapperPassPass() | ||
: llvm::createPostDomOnlyPrinterWrapperPassPass()); | ||
#endif | ||
} | ||
|
||
API_EXPORT(void) | ||
|
@@ -244,10 +254,12 @@ LLVMPY_AddAlwaysInlinerPass(LLVMPassManagerRef PM, bool insertLifetime) { | |
unwrap(PM)->add(llvm::createAlwaysInlinerLegacyPass(insertLifetime)); | ||
} | ||
|
||
#if LLVM_VERSION_MAJOR < 15 | ||
API_EXPORT(void) | ||
LLVMPY_AddArgPromotionPass(LLVMPassManagerRef PM, unsigned int maxElements) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean legacy version of this pass is available as well? I couldn't find it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I meant the new pass version, I wrote both of these comments together then saw the legacy pass still existed. On that note, the NPM setup slots in differently (using pipeline tuning options) so we can’t replace these in-situ. No needed for this change though. |
||
unwrap(PM)->add(llvm::createArgumentPromotionPass(maxElements)); | ||
} | ||
#endif | ||
|
||
API_EXPORT(void) | ||
LLVMPY_AddBreakCriticalEdgesPass(LLVMPassManagerRef PM) { | ||
|
@@ -333,12 +345,14 @@ LLVMPY_AddLoopUnrollAndJamPass(LLVMPassManagerRef PM) { | |
LLVMAddLoopUnrollAndJamPass(PM); | ||
} | ||
|
||
#if LLVM_VERSION_MAJOR < 15 | ||
API_EXPORT(void) | ||
LLVMPY_AddLoopUnswitchPass(LLVMPassManagerRef PM, bool optimizeForSize, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For reference the loop unswitch pass has been renamed to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for finding this, I have updated the code. |
||
bool hasBranchDivergence) { | ||
unwrap(PM)->add( | ||
createLoopUnswitchPass(optimizeForSize, hasBranchDivergence)); | ||
} | ||
#endif | ||
|
||
API_EXPORT(void) | ||
LLVMPY_AddLowerAtomicPass(LLVMPassManagerRef PM) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In particular, this defines the
LLVM_VERSION_MAJOR
macro referenced in various places in this PR.