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

taisei: update to 1.4.1 #49348

Closed
wants to merge 3 commits into from
Closed

taisei: update to 1.4.1 #49348

wants to merge 3 commits into from

Conversation

aryalaadi
Copy link
Contributor

Testing the changes

  • I tested the changes in this PR: YES

@aryalaadi aryalaadi changed the title taisei 1.4.1 version bump taisei: update to 1.4.1 Mar 25, 2024
srcpkgs/taisei/template Outdated Show resolved Hide resolved
@aryalaadi aryalaadi force-pushed the taisei branch 3 times, most recently from 6c2d90b to 37fc604 Compare March 25, 2024 17:15
srcpkgs/taisei/template Outdated Show resolved Hide resolved
@tornaria
Copy link
Contributor

Great! Could you submit your patches as PR to upstream?

@ahesford: this LGTM now

@ahesford
Copy link
Member

What motivates the switch to SSE2 contrary to upstream's specification?

Please add an explanation to the top of the zstdoom patch about why it's necessary. Also, because it would be best to send this patch upstream, you might consider a more descriptive argument like --disable-zstd instead of --monkey_patch_i686.

@tornaria
Copy link
Contributor

What motivates the switch to SSE2 contrary to upstream's specification?

I suggested it, since cglm uses sse2 intrinsics and makes no attempt at being compatible with sse. Note that x86_64 includes sse2 by definition, which is why -msse and -msse2 make no difference at all on 64 bits.

It's been discussed before that using sse2 is ok-ish for i686. We try to avoid it for core packages so the distro still has a chance of running in 25 year old cpus.

Please add an explanation to the top of the zstdoom patch about why it's necessary. Also, because it would be best to send this patch upstream, you might consider a more descriptive argument like --disable-zstd instead of --monkey_patch_i686.

This makes sense. As a matter of fact, I was thinking of just checking if arch is i686 directly in the python script rather than in meson.

@aryalaadi
Copy link
Contributor Author

This makes sense. As a matter of fact, I was thinking of just checking if arch is i686 directly in the python script rather than in meson.

how is the python script supposed to know target arch

@aryalaadi aryalaadi force-pushed the taisei branch 2 times, most recently from 8e1976d to 6fecac1 Compare March 27, 2024 04:27
aryalaadi added a commit to aryalaadi/taisei that referenced this pull request Mar 27, 2024
when packaging taisei for void-linux, the i686 builds were failing
the following changes fixes the build issues for i686

related: void-linux/void-packages#49348
@aryalaadi
Copy link
Contributor Author

Also, because it would be best to send this patch upstream

sure, but before that I will look into cglm and zstandard to see if I fix the root issue

srcpkgs/taisei/patches/zstdoom.patch Outdated Show resolved Hide resolved
srcpkgs/taisei/patches/zstdoom.patch Outdated Show resolved Hide resolved
@ahesford
Copy link
Member

I suggested it, since cglm uses sse2 intrinsics and makes no attempt at being compatible with sse. Note that x86_64 includes sse2 by definition, which is why -msse and -msse2 make no difference at all on 64 bits.

It's been discussed before that using sse2 is ok-ish for i686. We try to avoid it for core packages so the distro still has a chance of running in 25 year old cpus.

It seems OK to enable SSE2 if it fixes the build for i686. This should definitely be submitted upstream in case they know of some issue we don't, but we can carry the patch in the meantime.

srcpkgs/taisei/template Outdated Show resolved Hide resolved
@Akaricchi
Copy link
Contributor

Akaricchi commented Mar 27, 2024

-msse2 is ok, but the proper fix would be to correct this check in CGLM: https://github.com/recp/cglm/blob/1de373a9bd453d1fff6846db3a01ade8270f12bb/include/cglm/simd/intrin.h#L27

It should only check for SSE2 there. I can try to submit that upstream a bit later, though I'll need to set up a 32-bit environment to test it first.

For what it's worth, openSUSE doesn't build Taisei for i686, because CGLM fails (or at least used to fail) some unit tests on that platform. It doesn't look like i686 support is well maintained there, and we neither test nor provide i686 Linux builds of Taisei either. I don't believe there's an x86 system around that can handle this game acceptably well while not supporting x86-64.

As for why we enforce -msse: what we really want is -mfpmath=sse, which prevents the compiler from using x87 FPU instructions for floating point math. It's to reduce the potential for replay compatibility problems between different builds, due to the extended precision used by those instructions.

@tornaria
Copy link
Contributor

-msse2 is ok, but the proper fix would be to correct this check in CGLM: https://github.com/recp/cglm/blob/1de373a9bd453d1fff6846db3a01ade8270f12bb/include/cglm/simd/intrin.h#L27

It should only check for SSE2 there. I can try to submit that upstream a bit later, though I'll need to set up a 32-bit environment to test it first.

An easy way is to check out this branch, then do

./xbps-src -A i686 binary-bootstrap
./xbps-src -A i686 pkg cglm
./xbps-src -A i686 pkg taisei

You can put patches in srcpkgs/cglm/patches/*.patch before the pkg cglm step.

For what it's worth, openSUSE doesn't build Taisei for i686, because CGLM fails (or at least used to fail) some unit tests on that platform. It doesn't look like i686 support is well maintained there, and we neither test nor provide i686 Linux builds of Taisei either. I don't believe there's an x86 system around that can handle this game acceptably well while not supporting x86-64.

Isn't that a good reason to build with sse2 by default?

As for why we enforce -msse: what we really want is -mfpmath=sse, which prevents the compiler from using x87 FPU instructions for floating point math. It's to reduce the potential for replay compatibility problems between different builds, due to the extended precision used by those instructions.

You can achieve a similar result without sse using -ffloat-store (at a cost).

BTW, do you really need level=20 for zstd? That's supposed to use a lot of memory. Maybe 19 is good enough (or you could use something like 20 if sys.maxsize > 2**32 else 19).

@aryalaadi aryalaadi force-pushed the taisei branch 2 times, most recently from 0721e12 to 5c54c74 Compare March 27, 2024 14:51
@aryalaadi
Copy link
Contributor Author

musl builds failing now...

@Akaricchi
Copy link
Contributor

An easy way is to check out this branch, then do

I'm not a Void user, so I think I'll just set up the i686 version of Void in a container for testing.

Isn't that a good reason to build with sse2 by default?

I don't mind bumping it up to -msse2 upstream. I only went with -msse by default because that's the minimum requirement for -mfpmath=sse, and I was somewhat more conservative about i686 support back then.

You can achieve a similar result without sse using -ffloat-store (at a cost).

Not really. -ffloat-store only prevents individual variables from being stored in registers. It won't break up calculations in expressions, e.g. float x = a * b / (c - d); the whole thing will be computed in extended precision unless you move every calculation into a separate variable, which is not acceptable for Taisei. Even then, a calculation performed at 80-bit precision truncated to 64 bits may still have a slightly different result. Not to mention the overhead introduced by placing every single float variable into RAM.

BTW, do you really need level=20 for zstd? That's supposed to use a lot of memory. Maybe 19 is good enough (or you could use something like 20 if sys.maxsize > 2**32 else 19).

The script definitely wasn't written with limited memory/address space in mind. I'll try 19 on i686 and see if it helps.

There's an alternative solution though: you could split the package into taisei and taisei-data. The latter would be noarch and can be built just once, on a 64-bit userspace.

# taisei without data
cd /the/build/dir
ninja src/taisei doc/GAME.html doc/ENVIRON.html doc/STORY.txt doc/README.txt
meson install --destdir=/whatever --no-rebuild --tags runtime,doc,license,xdg
# taisei-data only
cd /the/build/dir
ninja resources/00-taisei.zip
meson install --destdir=/whatever --no-rebuild --tags resources

Unfortunately meson install isn't smart enough to only rebuild what's needed according to --tags, so the build targets have to be specified manually for now. I can alleviate this problem upstream by adding some shorthand alias build targets, though.

@Akaricchi
Copy link
Contributor

Akaricchi commented Mar 27, 2024

musl builds failing now...

Looks like another python-zstandard problem. My split package proposal should "fix" that too. But really it's python-zstandard that needs fixing here. You can also use meson configure -Dpackage_data=disabled to sidestep the whole compression issue.

@ahesford
Copy link
Member

We no longer support noarch packages, so there is no option but to build the package data for i686.

@tornaria
Copy link
Contributor

musl builds failing now...

Looks like another python-zstandard problem. My split package proposal should "fix" that too. But really it's python-zstandard that needs fixing here. You can also use meson configure -Dpackage_data=disabled to sidestep the whole compression issue.

This seems to be just a side-effect of zstd update which broke python-zstandard. Often the musl builders finish before the glibc builders, so your glibc CI run without the update and the musl CI run with the update.

Can you try again, now that python-zstandard has been rebuilt? (just rebase to current master and force push so the CI runs again).

@tornaria
Copy link
Contributor

BTW, do you really need level=20 for zstd? That's supposed to use a lot of memory. Maybe 19 is good enough (or you could use something like 20 if sys.maxsize > 2**32 else 19).

I tried this and it builds for i686 without any issues (on my machine, idk why github builds are failing)

Have you tried looking at "details" on the github run? It seems python3-zstandard is completely broken as you can check locally with

$ python -m zstandard
Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 148, in _get_module_details
  File "<frozen runpy>", line 112, in _get_module_details
  File "/usr/lib/python3.12/site-packages/zstandard/__init__.py", line 39, in <module>
    from .backend_c import *  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: zstd C API versions mismatch; Python bindings were not compiled/linked against expected zstd version (10506 returned by the lib, 10506 hardcoded in zstd headers, 10505 hardcoded in the cext)

It seems upstream for python3-zstandard hardcodes the version of zstd that can be used 🤦

@tornaria
Copy link
Contributor

@unspecd here in this PR we are having trouble with python3-zstandard which seems to be completely broken atm.

@unspecd
Copy link
Contributor

unspecd commented Mar 30, 2024

@tornaria
I just updated the package python3-zstandard.

@recp
Copy link

recp commented Mar 31, 2024

since cglm uses sse2 intrinsics and makes no attempt at being compatible with sse

I've just started to fix SSE / SSE2 compatibility issue at recp/cglm#412 since I have 64bit arch only any help, testing on see-only environment, feedback would be awesome

@recp
Copy link

recp commented Apr 1, 2024

For what it's worth, openSUSE doesn't build Taisei for i686, because CGLM fails (or at least used to fail) some unit tests on that platform. It doesn't look like i686 support is well maintained there, and we neither test nor provide i686 Linux builds of Taisei either.

@Akaricchi I have fixed some tests when -ffast-math option enable at: recp/cglm#412 maybe that caused to fail. I would like to see the test results to fix them asap. I also tried to test on 32bit Debian, all tests are passed now.

v0.9.4 of cglm is released: https://github.com/recp/cglm/releases I hope SSE can now work without any issue and SSE2 requirement 🚀

@aryalaadi
Copy link
Contributor Author

v0.9.4 of cglm is released: https://github.com/recp/cglm/releases I hope SSE can now work without any issue and SSE2 requirement 🚀

thank you, I'll bump the cglm package to 0.9.4 when I'm free

@aryalaadi aryalaadi force-pushed the taisei branch 5 times, most recently from 9084813 to a55738b Compare April 2, 2024 07:07
@aryalaadi
Copy link
Contributor Author

@tornaria I've added the python3-standard patch you suggested and also bumped (and adopted) cglm.

srcpkgs/cglm/template Outdated Show resolved Hide resolved
@tornaria
Copy link
Contributor

tornaria commented Apr 3, 2024

This looks better to me than #49606 in that it avoids the vendored zstd.

Copy link

github-actions bot commented Jul 3, 2024

Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.

@github-actions github-actions bot added the Stale label Jul 3, 2024
@github-actions github-actions bot removed the Stale label Jul 8, 2024
@classabbyamp
Copy link
Member

needs rebase

Copy link

github-actions bot commented Nov 6, 2024

Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.

@github-actions github-actions bot added the Stale label Nov 6, 2024
@github-actions github-actions bot closed this Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants