Skip to content

Commit

Permalink
fix symbol hiding problem
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Oct 27, 2023
1 parent ce56a67 commit 8d4da65
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 41 deletions.
40 changes: 16 additions & 24 deletions python_bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,17 @@ add_definitions(${LLVM_DEFINITIONS})

mlir_configure_python_dev_packages()

add_mlir_python_common_capi_library(
MLIRPythonCAPI
INSTALL_COMPONENT
MLIRPythonModules
INSTALL_DESTINATION
mlir/_mlir_libs
OUTPUT_DIRECTORY
"${MLIR_BINARY_DIR}/mlir/_mlir_libs"
RELATIVE_INSTALL_ROOT
"../../../.."
add_mlir_python_common_capi_library(MLIRPythonCAPI
INSTALL_COMPONENT MLIRPythonModules
INSTALL_DESTINATION mlir/_mlir_libs
OUTPUT_DIRECTORY "${MLIR_BINARY_DIR}/mlir/_mlir_libs"
RELATIVE_INSTALL_ROOT "../../../.."
DECLARED_HEADERS
MLIRPythonCAPI.HeaderSources
MLIRPythonCAPI.HeaderSources
DECLARED_SOURCES
MLIRPythonSources
MLIRPythonExtension.RegisterEverything
${_ADDL_TEST_SOURCES})
MLIRPythonSources
MLIRPythonExtension.RegisterEverything
)

# ##############################################################################
# Custom targets.
Expand All @@ -98,15 +93,12 @@ endif()
# The fully assembled package of modules. This must come last.
# ##############################################################################

add_mlir_python_modules(
MLIRPythonModules
ROOT_PREFIX
"${MLIR_BINARY_DIR}/mlir"
INSTALL_PREFIX
"mlir"
add_mlir_python_modules(MLIRPythonModules
ROOT_PREFIX "${MLIR_BINARY_DIR}/mlir"
INSTALL_PREFIX "mlir"
DECLARED_SOURCES
MLIRPythonSources
MLIRPythonExtension.RegisterEverything
${_ADDL_TEST_SOURCES}
MLIRPythonSources
MLIRPythonExtension.RegisterEverything
COMMON_CAPI_LINK_LIBS
MLIRPythonCAPI)
MLIRPythonCAPI
)
4 changes: 4 additions & 0 deletions python_bindings/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def build_extension(self, ext: CMakeExtension) -> None:
f"-DCMAKE_INSTALL_PREFIX={install_dir}",
f"-DPython3_EXECUTABLE={sys.executable}",
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
# prevent symbol collision that leads to multiple pass registration and such
"-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON",
"-DCMAKE_C_VISIBILITY_PRESET=hidden",
"-DCMAKE_CXX_VISIBILITY_PRESET=hidden",
]
if platform.system() == "Windows":
cmake_args += [
Expand Down
55 changes: 38 additions & 17 deletions scripts/gh_releases.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,50 @@
import os
import time

from github import Github
import datetime

# Authentication is defined via github.Auth
from github import Auth

# using an access token
auth = Auth.Token("Personal access tokens (classic)")
auth = Auth.Token(os.environ["GITHUB_API_TOKEN"])

twomonthsago = datetime.date.today() - datetime.timedelta(days=30)

# First create a Github instance:

# Public Web Github
g = Github(auth=auth)

repo = g.get_repo("makslevental/wheels")
release = repo.get_release(113028511)
assets = release.get_assets()
for ass in assets:
if "18.0.0.20230907" in ass.name:
print(ass.name)
assert ass.delete_asset()


repo = g.get_repo("makslevental/mlir-wheels")
release = repo.get_release(111725799)
assets = release.get_assets()
for ass in assets:
if "18.0.0.20230907" in ass.name:
print(ass.name)
assert ass.delete_asset()
n_deleted = 0
for _ in range(100):
n_deleted = 0
repo = g.get_repo("makslevental/wheels")
release = repo.get_release(113028511)
assets = release.get_assets()
for ass in assets:
if "35ca6498" in ass.name:
continue
if ass.created_at.date() < twomonthsago:
print(ass.name)
assert ass.delete_asset()
n_deleted += 1

repo = g.get_repo("makslevental/mlir-wheels")
release = repo.get_release(111725799)
assets = release.get_assets()
for ass in assets:
if "35ca6498" in ass.name:
continue
if ass.created_at.date() < twomonthsago:
print(ass.name)
assert ass.delete_asset()
n_deleted += 1

if n_deleted == 0:
break
time.sleep(5)

if n_deleted > 0:
raise Exception("missed some")
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ def build_extension(self, ext: CMakeExtension) -> None:
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}",
f"-DPython3_EXECUTABLE={sys.executable}",
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
# prevent symbol collision that leads to multiple pass registration and such
"-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON",
"-DCMAKE_C_VISIBILITY_PRESET=hidden",
"-DCMAKE_CXX_VISIBILITY_PRESET=hidden",
]
if platform.system() == "Windows":
cmake_args += [
Expand Down

0 comments on commit 8d4da65

Please sign in to comment.