From a2505b3f7e70ace69ee2cc40b8fb11bfd5a42c1e Mon Sep 17 00:00:00 2001 From: Sasha Lopoukhine Date: Mon, 16 Dec 2024 16:59:17 +0000 Subject: [PATCH 1/2] CI: add lockfile update action to manually trigger for dependabot PRs (#3647) I tested it [here](https://github.com/xdslproject/xdsl/pull/3646) and it works if you do the dumb thing and trigger on push, but it seems to not run actions on unsigned commits by default. I'm hoping that if we trigger the action manually it'll inherit the clicker's permissions and re-run the action. In either case, I think whatever we adopt should supercede the cron job one as we want to never be out of sync between the pyproject and lockfile. --- .github/workflows/update-bot.yml | 38 ----------------------- .github/workflows/update-lockfile-bot.yml | 32 +++++++++++++++++++ 2 files changed, 32 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/update-bot.yml create mode 100644 .github/workflows/update-lockfile-bot.yml diff --git a/.github/workflows/update-bot.yml b/.github/workflows/update-bot.yml deleted file mode 100644 index f05c4f0d5c..0000000000 --- a/.github/workflows/update-bot.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Update Bot - -on: - workflow_dispatch: - # Set the schedule, every week at 8:00am on Monday - schedule: - - cron: 0 8 * * 1 - -permissions: - contents: write - pull-requests: write - -jobs: - lock: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: astral-sh/setup-uv@v3 - - - run: | - echo "\`\`\`" > uv_output.md - uv lock &>> uv_output.md - echo "\`\`\`" >> uv_output.md - - - name: Create pull request - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: Update uv lockfile - title: Update uv lockfile - body-path: uv_output.md - branch: update-uv - base: main - labels: install - delete-branch: true - add-paths: uv.lock - assignees: math-fehr, georgebisbas, superlopuh diff --git a/.github/workflows/update-lockfile-bot.yml b/.github/workflows/update-lockfile-bot.yml new file mode 100644 index 0000000000..93c5bf1b4e --- /dev/null +++ b/.github/workflows/update-lockfile-bot.yml @@ -0,0 +1,32 @@ +name: Update Lockfile Bot + +on: + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + lock: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + cache-dependency-glob: "uv.lock" + + - name: Set up Python + run: uv python install 3.12 + + - name: Install the package locally and update lockfile + run: | + # Install all default extras. + XDSL_VERSION_OVERRIDE="0+dynamic" make venv + + - uses: EndBug/add-and-commit@v9 + with: + add: uv.lock From 3725f40fdc21c91d069f1ac523e7fce25efcdbd3 Mon Sep 17 00:00:00 2001 From: Chris Vasiladiotis Date: Mon, 16 Dec 2024 17:01:34 +0000 Subject: [PATCH 2/2] dialects (llvm): Add dense array constraint for the `position` attribute of `llvm.extractvalue` and `llvm.insertvalue` operations (#3643) This PR: - Adds a dense array constraint for the `position` attribute of `llvm.extractvalue` and `llvm.insertvalue` operations, restricting to `i64` as in MLIR. - Filecheck tests of the above Resolves #3155 --- tests/filecheck/dialects/llvm/invalid.mlir | 21 ++++++++++++++++++++- xdsl/dialects/builtin.py | 4 ++++ xdsl/dialects/llvm.py | 5 +++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/tests/filecheck/dialects/llvm/invalid.mlir b/tests/filecheck/dialects/llvm/invalid.mlir index 09627efd7a..0f5d854a6f 100644 --- a/tests/filecheck/dialects/llvm/invalid.mlir +++ b/tests/filecheck/dialects/llvm/invalid.mlir @@ -7,10 +7,29 @@ builtin.module { // CHECK: Varargs specifier `...` must be at the end of the argument definition // ----- -// CHECK: ----- builtin.module { %cc = "test.op"() {"cconv" = #llvm.cconv} : () -> () } // CHECK: Unknown calling convention + +// ----- + +func.func public @main() { + %0 = "test.op"() : () -> (!llvm.struct<(i32)>) + %1 = "llvm.extractvalue"(%0) {"position" = array} : (!llvm.struct<(i32)>) -> i32 + func.return +} + +// CHECK: Expected attribute i64 but got i32 + +// ----- + +func.func public @main() { + %0, %1 = "test.op"() : () -> (!llvm.struct<(i32)>, i32) + %2 = "llvm.insertvalue"(%0, %1) {"position" = array} : (!llvm.struct<(i32)>, i32) -> !llvm.struct<(i32)> + func.return +} + +// CHECK: Expected attribute i64 but got i32 diff --git a/xdsl/dialects/builtin.py b/xdsl/dialects/builtin.py index f24f2c83fa..e4bf295f56 100644 --- a/xdsl/dialects/builtin.py +++ b/xdsl/dialects/builtin.py @@ -1248,6 +1248,10 @@ def __len__(self) -> int: return len(self.data.data) // self.elt_type.size +DenseI64ArrayConstr = ParamAttrConstraint(DenseArrayBase, [i64, BytesAttr]) +"""Type constraint for DenseArrays containing integers of i64 integers.""" + + @irdl_attr_definition class FunctionType(ParametrizedAttribute, TypeAttribute): name = "fun" diff --git a/xdsl/dialects/llvm.py b/xdsl/dialects/llvm.py index dd3752ff43..3d767ac40e 100644 --- a/xdsl/dialects/llvm.py +++ b/xdsl/dialects/llvm.py @@ -12,6 +12,7 @@ ArrayAttr, ContainerType, DenseArrayBase, + DenseI64ArrayConstr, IndexType, IntAttr, IntegerAttr, @@ -1262,7 +1263,7 @@ class ExtractValueOp(IRDLOperation): name = "llvm.extractvalue" - position = prop_def(DenseArrayBase) + position = prop_def(DenseI64ArrayConstr) container = operand_def(Attribute) res = result_def(Attribute) @@ -1292,7 +1293,7 @@ class InsertValueOp(IRDLOperation): name = "llvm.insertvalue" - position = prop_def(DenseArrayBase) + position = prop_def(DenseI64ArrayConstr) container = operand_def(Attribute) value = operand_def(Attribute)