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

Fix the AVX2 backend build #575

Closed
wants to merge 1 commit into from

Conversation

dkostic
Copy link

@dkostic dkostic commented Dec 23, 2024

Summary:
For reasons that elude me, this fixed issue #574 on my machine.

Steps:
If your pull request consists of multiple sequential changes, please describe them here:

Performed local tests:

  • lint passing
  • tests all passing
  • tests bench passing
  • tests cbmc passing

Do you expect this change to impact performance: Yes/No

If yes, please provide local benchmarking results.

@dkostic dkostic requested a review from a team as a code owner December 23, 2024 23:16
@dkostic dkostic force-pushed the fix-avx2-backend-build branch from b4f57a9 to 9dbbb27 Compare December 23, 2024 23:17
@@ -29,7 +29,7 @@ CC_AR := $(CROSS_PREFIX)$(CC_AR)
#################
# Common config #
#################
CFLAGS := \
CFLAGS += \
Copy link
Contributor

@hanno-becker hanno-becker Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we can't do that without reverting also the change removing EXTRAFLAGS at the end: We want user specified CFLAGS do overwrite default CFLAGS, but with this version it's the other way around

@hanno-becker
Copy link
Contributor

hanno-becker commented Dec 24, 2024

The issue is lazy vs. eager evaluation of ARCH_FLAGS within CFLAGS: with := the variable is eagerly evaluated at time of definition, while with += it is lazily evaluated. This matters since auto.mk sets default ARCH_FLAGS only later based on your system.

Some options:

  1. Just move the inclusion of auto.mk upwards before the setting of CFLAGS.
  2. Modify CFLAGS, not ARCH_FLAGS, in auto.mk. We still need to keep ARCH_FLAGS in the CFLAGS defaults though because some test scripts set it, too.
  3. Make a copy of the original CFLAGS as (say) ORIG_CFLAGS := $CFLAGS and switch back to lazy evaluation for CFLAGS, but using ORIG_CFLAGS in the end.

If it works, 2. would be simplest. Can you try @dkostic ?

Copy link
Contributor

@hanno-becker hanno-becker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @dkostic for spotting this. make apparently eludes me, too.

See the comment for what happened. For the fix we can't use the proposed change as we want to give the original CFLAGS precedence. It seems simplest to have auto.mk amend CFLAGS, not ARCH_FLAGS. The distinction is anyway not a technical one. Could you please also adjust the CI tests to pass FORCE_AARCH64 and FORCE_X86_64 accordingly, so this would have been caught?

Before we can consider merging, we need to move this PR to a non-remote branch -- this is because of some peculiarities about our EC2 CI still... (sorry!) @mkannwischer can you either give @dkostic developer rights so he can push branches, or otherwise run CI yourself when things look final?

@mkannwischer
Copy link
Contributor

Before we can consider merging, we need to move this PR to a non-remote branch -- this is because of some peculiarities about our EC2 CI still... (sorry!) @mkannwischer can you either give @dkostic developer rights so he can push branches, or otherwise run CI yourself when things look final?

Sorting out access during the holiday's is likely going to be impossible as it need approval in the TSC repository. Happy to merge this into a local branch first to run the full CI.

@mkannwischer
Copy link
Contributor

The issue is lazy vs. eager evaluation of ARCH_FLAGS within CFLAGS: with := the variable is eagerly evaluated at time of definition, while with += it is lazily evaluated. This matters since auto.mk sets default ARCH_FLAGS only later based on your system.

Some options:

  1. Just move the inclusion of auto.mk upwards before the setting of CFLAGS.
  2. Modify CFLAGS, not ARCH_FLAGS, in auto.mk. We still need to keep ARCH_FLAGS in the CFLAGS defaults though because some test scripts set it, too.
  3. Make a copy of the original CFLAGS as (say) ORIG_CFLAGS := $CFLAGS and switch back to lazy evaluation for CFLAGS, but using ORIG_CFLAGS in the end.

If it works, 2. would be simplest. Can you try @dkostic ?

I implemented (2) in #578 - let's get that merged quick and discuss any further improvment separatelty.

@hanno-becker
Copy link
Contributor

Thanks @mkannwischer!

With this merged, how should this be detected in the future? Either of (a) not setting arch flags in CI, but relying on defaults, or (b) passing FORCE_xxx would have caught this -- we should probably do both. Note though that even with (a), what we benchmark is not the default build, because the latter disables LTO.

@mkannwischer
Copy link
Contributor

Superseded by #578

@mkannwischer
Copy link
Contributor

Thanks @mkannwischer!

With this merged, how should this be detected in the future? Either of (a) not setting arch flags in CI, but relying on defaults, or (b) passing FORCE_xxx would have caught this -- we should probably do both. Note though that even with (a), what we benchmark is not the default build, because the latter disables LTO.

Let's do both.

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.

3 participants