Skip to content

Conversation

@jodavies
Copy link
Collaborator

@jodavies jodavies commented May 9, 2024

Various buffers in AllocSort depend on the IOsize parameter. At the
main level this is >= MaxTermSize, but this was not the case when
sorting function args, dollar variables.

Fixes the examples in #80 #292

@jodavies
Copy link
Collaborator Author

jodavies commented May 9, 2024

I am unsure about adding a test for #80 : in that case failure means writing out enormous files on github actions...

@coveralls
Copy link

coveralls commented May 9, 2024

Coverage Status

coverage: 48.765% (-0.02%) from 48.788%
when pulling f316287 on jodavies:issue-80
into 74735f5 on vermaseren:master.

@jodavies
Copy link
Collaborator Author

jodavies commented May 9, 2024

With 32bits, we can't have a MaxTermSize large enough for this test, it is limited by
https://github.com/vermaseren/form/blob/0112aa6b21b48616575c6cd205ec00c7797dbc93/sources/setfile.c#L437

This test needs to be skipped for 32 bits probably, or I will try to make a version of the test with smaller expressions and buffer sizes that works for 32bit also.

@vermaseren
Copy link
Collaborator

vermaseren commented May 9, 2024 via email

@jodavies
Copy link
Collaborator Author

jodavies commented May 9, 2024

Hi Jos,

At least in the test suite it is already easy to disable tests for 32bit word size.

I was actually trying to change the allocation to help with debugging these cases, but got stuck at some point. I want to split the large allocation in AllocSort into lots of smaller ones, so that buffer overruns there will trigger a valgrind error. But it seems that some buffers at least, must be contiguous: the large buffer + extended small buffer, for instance. Are there any others that are used in a combined way?

@vermaseren
Copy link
Collaborator

vermaseren commented May 9, 2024 via email

@tueda
Copy link
Collaborator

tueda commented May 9, 2024

At least in the test suite it is already easy to disable tests for 32bit word size.

It is actually "difficult" because now FORM doesn't give any information about 32/64bit directly, and that's why by make check you are always warned as

warning: failed to get the wordsize of '../sources/form'
warning: assuming wordsize = 4

It was "easy" in version 4.3.

@jodavies
Copy link
Collaborator Author

Sure, but still it is easy to use #require wordsize == 4 right? Anyway, at least in this case the test is now suitable for 32bit builds.

While investigating this I noticed that the "default" buffer sizes are somehow "not good", since AllocSort alters a lot of them before making the actual allocation. It is a bit hard for the user to know if their specified buffers are actually used in the end. Maybe some warnings could be printed from there (at allwarnings level?) for interested users...

@tueda
Copy link
Collaborator

tueda commented May 10, 2024

Sure, but still it is easy to use #require wordsize == 4 right?

Right. Indeed, for 32-bit containers, we inform the test suite that the FORM binary uses wordsize = 2.

https://github.com/vermaseren/form/blob/0112aa6b21b48616575c6cd205ec00c7797dbc93/.github/workflows/test.yml#L280

While investigating this I noticed that the "default" buffer sizes are somehow "not good", since AllocSort alters a lot of them before making the actual allocation. It is a bit hard for the user to know if their specified buffers are actually used in the end. Maybe some warnings could be printed from there (at allwarnings level?) for interested users...

Probably developers also need this. In some test cases, we fix many buffer sizes to reproduce specific conditions. If the way to alter the buffer sizes is changed in future versions (which may be triggered by changing the default settings for other buffers, like this), then our assumptions about the fixed buffer sizes could easily be invalidated. We need errors when the default or specified parameters are altered to different values.

@jodavies
Copy link
Collaborator Author

Errors might be a bit of a pain for regular use though (and like the tests, various real-world scripts will suddenly stop running), but maybe a mode that can be enabled? On ExactBuffers; or something.

jodavies added 2 commits May 18, 2024 07:40
Various buffers in AllocSort depend on the IOsize parameter. At the
main level this is >= MaxTermSize, but this was not the case when
sorting function args, dollar variables.

Fixes the examples in form-dev#80 form-dev#292
@tueda
Copy link
Collaborator

tueda commented May 21, 2024

Maybe this PR is ready to merge and indeed has a high priority?

@jodavies
Copy link
Collaborator Author

Yes, this one is important. Several of the recently committed tests are effectively implementing this by manually setting SubSortIOSize to be able to run. Should we remove those manual settings again, along with this?

@tueda
Copy link
Collaborator

tueda commented May 21, 2024

I think for now we can keep the manual buffer settings in the tests (unless they conflict with the automatic settings).

I will merge this PR as well.

@tueda tueda merged commit afc48b7 into form-dev:master May 21, 2024
jodavies added a commit to jodavies/form that referenced this pull request May 25, 2024
…usted.

Works towards form-dev#515 (comment)

I am not sure we want to warn here in the "default" mode. Maybe if "allwarnings"?
jodavies added a commit to jodavies/form that referenced this pull request May 27, 2024
…usted.

Works towards form-dev#515 (comment)

I am not sure we want to warn here in the "default" mode. Maybe if "allwarnings"?
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.

4 participants