iree icon indicating copy to clipboard operation
iree copied to clipboard

ld error backward reference detected

Open jpienaar opened this issue 3 years ago • 4 comments

What happened?

Got

Linking third_party/iree/tools/_iree-mlir-lsp-server_cc_binary failed

with

ld: error: backward reference detected: _ZN4mlir13iree_compiler35addIREEComprehensiveBufferizePassesERNS_13OpPassManagerEN4llvm8OptionalINSt3__u8functionIFNS_9FailureOrINS_5ValueEEERNS_9OpBuilderENS_8LocationENS_10MemRefTypeENS_10ValueRangeEjEEEEENS4_INS6_IFNS_13LogicalResultESB_SC_S8_EEEEENS4_INS6_IFSI_SB_SC_S8_S8_EEEEE in bazel-out/k8-opt/bin/third_party/iree/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/_objs/CommonExtensions/CommonExtensions.o refers to bazel-out/k8-opt/bin/third_party/iree/compiler/src/iree/compiler/Codegen/Common/_objs/Common/IREEComprehensiveBufferizePass.o

while building internally @ acc111bb3e7831afcfd4c4b4fa72cb28f9b0eb97 . I haven't repro'd in full OSS yet.

Steps to reproduce your issue

No response

What component(s) does this issue relate to?

Other

Version information

No response

Additional context

No response

jpienaar avatar Jul 19 '22 01:07 jpienaar

Is this only happening with iree-mlir-lsp-server, or with other binaries also? That particular binary is for developer use via IDEs and is not depended on by any tests or anything user-facing. I'm not aware of anyone who builds that binary with Bazel, but the Bazel build targets were added for parity with CMake. (so feel free to disable in your downstream integrate, or hack at the upstream Bazel build target definition as needed)

ScottTodd avatar Jul 19 '22 01:07 ScottTodd

Good question, I'll try disabling that one and see if only one

jpienaar avatar Jul 19 '22 02:07 jpienaar

@jpienaar labeling as P1 assigned to you - please change if needed.

allieculp avatar Jul 19 '22 16:07 allieculp

Only for that target so will disable downstream and lower priority here.

jpienaar avatar Jul 19 '22 19:07 jpienaar

Well I'm hitting this on another internal build and searched for the problem and this is the second hit :facepalm: I'm hitting the issue linking iree-dialects-opt

ld: error: backward reference detected: _ZN4mlir13iree_compiler4IREE9LinalgExt33createLinalgStrategyDecomposePassERKNS_6linalg26LinalgTransformationFilterE in iree/llvm-external-projects/iree-dialects/_objs/IREELinalgExtPasses/Passes.o refers to llvm-external-projects/iree-dialects/_objs/IREELinalgExtTransforms/Transforms.o

I'm guessing this is something that isn't properly declaring its dependencies?

GMNGeoffrey avatar Oct 10 '22 14:10 GMNGeoffrey

I suspect that if we added --warn-backrefs to our OSS build we would be able to repro this

GMNGeoffrey avatar Oct 10 '22 14:10 GMNGeoffrey

:-( I reasoned this was due to transform dialect being in a partially moved state when I encountered the issue. We can check where the bazel and cmake differs for these, most likely in LLVM monorepo.

jpienaar avatar Oct 10 '22 14:10 jpienaar

warn-backrefs didn't give me warning in OSS, don't know why, but I do see:

bin/third_party/iree/llvm-external-projects/iree-dialects/_objs/IREELinalgExtTransforms/Transforms.o: lazy definition of _ZN4mlir13iree_compiler4IREE9LinalgExt33createLinalgStrategyDecomposePassERKNS_6linalg26LinalgTransformationFilterE
bin/third_party/iree/llvm-external-projects/iree-dialects/_objs/IREELinalgExtPasses/Passes.o: reference to _ZN4mlir13iree_compiler4IREE9LinalgExt33createLinalgStrategyDecomposePassERKNS_6linalg26LinalgTransformationFilterE
bin/third_party/iree/llvm-external-projects/iree-dialects/_objs/IREELinalgExtTransforms/Transforms.o: definition of _ZN4mlir13iree_compiler4IREE9LinalgExt33createLinalgStrategyDecomposePassERKNS_6linalg26LinalgTransformationFilterE

jpienaar avatar Oct 10 '22 21:10 jpienaar

An option is setting IREELinalgExtTransforms as alwayslink, the other is combining these two rules into one (and adding an alias).

jpienaar avatar Oct 10 '22 21:10 jpienaar

Probably 2 tasks here 1) fix this for IREELinalgExt (I'm not sure what goes into llvm-external-projects related to LinalgExt and curating there), 2) get checking in main CI working to flag earlier

jpienaar avatar Oct 10 '22 22:10 jpienaar

So the issue is a circular dependency then?

GMNGeoffrey avatar Oct 11 '22 08:10 GMNGeoffrey

Sort of yes. I don't know why this hits here while we have others that follow similar pattern (I have a suspicion and it would probably be something small, wrong macro used level, but couldn't spot in the time yesterday). I'm more "upset" that I couldn't repro it still in OSS (even with extra linkopts), perhaps I'm synced to wrong git rev and has been fixed, but more likely there are additional settings needed.

jpienaar avatar Oct 11 '22 13:10 jpienaar

We have this checking enabled now and missing case addressed . Issue is still open until the transforms & passes symbol issue is resolved / aliases removed.

jpienaar avatar Oct 19 '22 17:10 jpienaar