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

RTC #Line #615

Merged
merged 2 commits into from
Aug 14, 2021
Merged

RTC #Line #615

merged 2 commits into from
Aug 14, 2021

Conversation

Robadob
Copy link
Member

@Robadob Robadob commented Aug 4, 2021

This is currently a draft, we need to decide how we want these line numbers to appear.

e.g.

If a user has not got EXPORT_RTC_SOURCES enabled, then their only reference to line, is the string/file they pass to FLAMEGPU. So first line of that should be line 1 (ignoring injected includes etc).

If a user has got EXPORT_RTC_SOURCES enabled, then instead it can be assumed they will be referring to the exported files. In which case, the start of that string should be appended #line 2 filename. 2, because the exported source will include the #line statement on line 1.

I'm not really a fan of this inconsistency, but it makes sense. So if agreed I will tweak the PR to handle those cases.

Addresses #608

@ptheywood
Copy link
Member

Sounds like the best choice, although i agree that the inconcistency feels a bit grim, but probably the most useful / practical option.

@Robadob
Copy link
Member Author

Robadob commented Aug 13, 2021

Another thought, re RTC agent functions defined in code. They open the string on it's own line. So presumably the string begins with a newline, so really want to trim that opening newline if it exists, because no one is considering an empty newline line 1

@Robadob Robadob force-pushed the rtc_line_no branch 2 times, most recently from a838fc5 to 8cdf82d Compare August 13, 2021 10:09
@Robadob Robadob requested a review from ptheywood August 13, 2021 10:09
@Robadob Robadob marked this pull request as ready for review August 13, 2021 10:09
Copy link
Member

@ptheywood ptheywood left a comment

Choose a reason for hiding this comment

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

Have you ran the full test suite on this? I get errors with RTC function conditions

[  FAILED  ] 2 tests, listed below:
[  FAILED  ] DeviceRTCAPITest.AgentFunction_cond_rtc
[  FAILED  ] RTCMultiThreadDeviceTest.SameModelMultiDevice_AgentFunctionCondition
[ RUN      ] DeviceRTCAPITest.AgentFunction_cond_rtc
---------------------------------------------------
--- JIT compile log for #line 1 "rtc_test_func_impl_condition.cu" ---
---------------------------------------------------
#line 1 "rtc_test_func_impl_condition.cu"(1): error: this declaration has no storage class or type specifier

limits(7): error: expected a ";"

limits(50): warning: parsing restarts here after previous syntax error

limits(51): error: expected a declaration

limits(108): error: expected a declaration

limits(111): warning: parsing restarts here after previous syntax error

limits(112): error: numeric_limits is not a template

limits(113): error: name followed by "::" must be a class or namespace name

limits(113): error: expected an identifier

limits(113): error: not a class or struct name

limits(113): error: class or struct definition is missing

At end of source: warning: parsing restarts here after previous syntax error

At end of source: error: expected a ";"

10 errors detected in the compilation of "#line 1 "rtc_test_func_impl_condition.cu"".

---------------------------------------------------
unknown file: Failure
C++ exception with description "/home/ptheywood/code/flamegpu/FLAMEGPU2/src/flamegpu/util/detail/JitifyCache.cu(331): Error compiling runtime agent function (or function condition) ('rtc_test_func_condition'): function had compilation errors (see std::cout), in JitifyCache::buildProgram()." thrown in the test body.

@Robadob
Copy link
Member Author

Robadob commented Aug 13, 2021

Nope, will get around to that Monday. Good shout, was supposed to be a simple change.

@Robadob
Copy link
Member Author

Robadob commented Aug 13, 2021

I presume it's the same issue I had on agent functions, I just forgot to remove the breaking bit from conditions too.

@Robadob
Copy link
Member Author

Robadob commented Aug 13, 2021

It can't be, that's one bit of code so same fix applies.

Looking at this, it might not even like the #line statement

#line 1 "rtc_test_func_impl_condition.cu"(1): error: this declaration has no storage class or type specifier

Edit: Have been able to reproduce this error, it appears to be same issue, with #line being injected before filename of the agent function condition src. Not immediately clear why that doesn't affect agentfn, but should be fixable.

Edit2: Problem was in both, but only visible in agentfn condition, due to bad ifdef. Should have fixed it now, also added missing RTC agent function condition from file method.

This differs if EXPORT_RTC_SOURCES is enabled, so that line numbers are correct relative to the exported file (which contains injected includes too).

Otherwise, line number is at the start of the user defined RTC agent function string, however if the line begins with a linebreak, that opening linebreak is trimmed.

Closes #608
This was missed when support for loading RTC agent functions from file was added.
@Robadob
Copy link
Member Author

Robadob commented Aug 13, 2021

Debug build.

[----------] Global test environment tear-down
[==========] 868 tests from 68 test suites ran. (791154 ms total)
[  PASSED  ] 868 tests.

  YOU HAVE 38 DISABLED TESTS

Enabled EXPORT_RTC_SOURCES and got the same

[----------] Global test environment tear-down
[==========] 868 tests from 68 test suites ran. (838150 ms total)
[  PASSED  ] 868 tests.

  YOU HAVE 38 DISABLED TESTS

@Robadob Robadob requested a review from ptheywood August 13, 2021 19:33
@Robadob Robadob changed the title Draft of RTC #Line RTC #Line Aug 13, 2021
Copy link
Member

@ptheywood ptheywood left a comment

Choose a reason for hiding this comment

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

Linux tests now all pass.

@Robadob Robadob merged commit fbc9fe7 into master Aug 14, 2021
@Robadob Robadob deleted the rtc_line_no branch August 14, 2021 13:11
@ptheywood ptheywood added the v2.0.0-alpha.1 Issues merged in to the 2.0.0-alpha.1 release label Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires review v2.0.0-alpha.1 Issues merged in to the 2.0.0-alpha.1 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RTC compilation should provide the correct line numbers in compile errors.
2 participants