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

embree: refactor to work in Linux #74332

Closed
wants to merge 1 commit into from

Conversation

danielnachun
Copy link
Member

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

@danielnachun danielnachun added the linux to homebrew-core Migration of linuxbrew-core to homebrew-core label Apr 1, 2021
@BrewTestBot BrewTestBot added the no ARM bottle Formula has no ARM bottle label Apr 1, 2021
Comment on lines +20 to +25
max_isa = "SSE4.2"

on_macos do
max_isa = "SSE2" unless MacOS.version.requires_sse42?
end
Copy link
Member

Choose a reason for hiding this comment

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

I think we require Nehalem as a minimal CPU, which would make this useless. Someone from @Homebrew/brew probably knows that better.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

So in core the minimal supported CPU will always support sse4.2

Copy link
Member

Choose a reason for hiding this comment

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

It won't work if you're still on High Sierra, though. I know we don't support High Sierra, but I also think we shouldn't knowingly break things for users still on it, especially when the accommodation is minor.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree that this is a sufficiently small accommodation that it probably doesn't hurt to leave it in.

@@ -17,7 +17,11 @@ class Embree < Formula
depends_on "tbb"

def install
max_isa = MacOS.version.requires_sse42? ? "SSE4.2" : "SSE2"
max_isa = "SSE4.2"
Copy link
Member

Choose a reason for hiding this comment

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

On Linux oldest_cpu is core2 which does not support SSE4.2, but does support SSE3.

‘core2’ Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 instruction set support.
‘nehalem’ Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and POPCNT instruction set support.

See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
and https://en.wikipedia.org/wiki/List_of_Intel_CPU_microarchitectures

Copy link
Member Author

Choose a reason for hiding this comment

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

I see this isn't bottled on Linux, and will probably have cellar :any when it is bottled, so it will probably never be built from source unless explicitly requested. If our CI env supports SSE4.2 but a user tries to install the bottle on a system which only support SSE2, would that result in a broken bottle?

Perhaps the solution here is to use SSE2 on Linux so that the bottle works everywhere, and users who want better optimized instructions can build from source? This is the first time I've seen this particular scenario so I'm not sure how we should handle it.

Copy link
Member

Choose a reason for hiding this comment

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

If our CI env supports SSE4.2 but a user tries to install the bottle on a system which only support SSE2, would that result in a broken bottle?

It depends on whether the executable detects at run time which instruction set is available, or if it always uses the instruction set that was specified at compile time. There's unfortunately no way to know without testing, or reading the upstream documentation.

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps the solution here is to use SSE2 on Linux so that the bottle works everywhere

Yes.

and users who want better optimized instructions can build from source?

We don't support building from source so I'd rather we didn't point them in that direction.

Copy link
Member

@sjackman sjackman Apr 2, 2021

Choose a reason for hiding this comment

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

On a similar topic, with GitHub Packages it would be possible to upload bottles compiled for different Intel CPUs (different microarchitectures) thanks to OCI/Docker's support for multi-architecture images.

Copy link
Member

Choose a reason for hiding this comment

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

If it does runtime ISA checks, then can we drop max_isa from this formula?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's what I'm thinking. I need to test this on a server I have access to which has multiple generations of CPUs where I can try to build it with full set of supported ISAs (up to AVX-512) and then test on some older CPUs that definitely don't have that ISA. I'm not sure if there is anything on macOS which limits ISA support beyond the hardware itself - I don't know what determines MacOS.version.requires_sse42?.

Copy link
Member

Choose a reason for hiding this comment

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

#requires_sse42? is just a check for whether the oldest CPU that runs a given OS is older than Nehalem, I think: https://rubydoc.brew.sh/OS/Mac/Version.html#requires_nehalem_cpu%3F-instance_method

Though now that you mention OpenBLAS I'm wondering whether this is needed:

ENV["NO_AVX512"] = "1"

Copy link
Member Author

Choose a reason for hiding this comment

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

That was probably related to some issues upstream had with the AVX-512 kernels not working correctly: OpenMathLib/OpenBLAS#2182. However, those issues seem to have been fixed, so we should see if it works properly again.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like you have access to a good testing environment for that :)

@github-actions
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Apr 24, 2021
@danielnachun danielnachun removed the stale No recent activity label Apr 26, 2021
@danielnachun danielnachun deleted the embree branch May 1, 2021 00:30
@danielnachun danielnachun restored the embree branch May 1, 2021 00:34
@danielnachun danielnachun reopened this May 1, 2021
@github-actions
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label May 23, 2021
@carlocab carlocab mentioned this pull request May 26, 2021
5 tasks
@danielnachun danielnachun removed the stale No recent activity label May 28, 2021
@iMichka
Copy link
Member

iMichka commented Jun 15, 2021

Can we rebase this? What remains to be done to be able to move this forward?

@danielnachun danielnachun dismissed a stale review via 563a25a June 18, 2021 02:25
@BrewTestBot BrewTestBot removed the no ARM bottle Formula has no ARM bottle label Jun 18, 2021
@danielnachun
Copy link
Member Author

I rebased this. The unresolved question here is whether we even need to use a maximum supported ISA, as it seem this software checks if the needed instruction sets are supported at runtime. If that is the case, we can enable the newest ISA and for uses on older systems, it would automatically ignore the unsupported instructions without failing. I will try to this on the oldest server I can find in the cluster I use and confirm that it works with AVX-512 enabled.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Jul 9, 2021
@danielnachun danielnachun removed the stale No recent activity label Jul 11, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Aug 2, 2021
@danielnachun danielnachun removed the stale No recent activity label Aug 6, 2021
@github-actions
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Aug 27, 2021
@danielnachun danielnachun removed the stale No recent activity label Aug 27, 2021
@github-actions
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Sep 18, 2021
@danielnachun danielnachun added in progress Stale bot should stay away and removed stale No recent activity labels Sep 18, 2021
@iMichka
Copy link
Member

iMichka commented Oct 9, 2021

Going to close this until this is figured out. This PR has been open for way too long, and there is no point fighting with the stale bot forever :)

@iMichka iMichka closed this Oct 9, 2021
@github-actions github-actions bot added the outdated PR was locked due to age label Nov 9, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2021
@danielnachun danielnachun deleted the embree branch October 1, 2022 23:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in progress Stale bot should stay away linux to homebrew-core Migration of linuxbrew-core to homebrew-core outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants