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

detail::path_base() doesn't handle Linux path separators on Windows #87

Closed
Robadob opened this issue May 13, 2021 · 1 comment · Fixed by #88
Closed

detail::path_base() doesn't handle Linux path separators on Windows #87

Robadob opened this issue May 13, 2021 · 1 comment · Fixed by #88

Comments

@Robadob
Copy link
Contributor

Robadob commented May 13, 2021

Was attempting to test whether a kernel with GLM would build with NVRTC (I'm not hopeful).

Ran into a failure, where all GLMs nested #include statements were failing to resolve.

glm/glm.hpp(105): warning: detail/_fixes.hpp: [jitify] File not found
glm/glm.hpp(107): warning: detail/setup.hpp: [jitify] File not found
glm/glm.hpp(114): warning: fwd.hpp: [jitify] File not found
glm/glm.hpp(116): warning: vec2.hpp: [jitify] File not found
glm/glm.hpp(117): warning: vec3.hpp: [jitify] File not found
glm/glm.hpp(118): warning: vec4.hpp: [jitify] File not found
glm/glm.hpp(119): warning: mat2x2.hpp: [jitify] File not found
glm/glm.hpp(120): warning: mat2x3.hpp: [jitify] File not found
glm/glm.hpp(121): warning: mat2x4.hpp: [jitify] File not found
glm/glm.hpp(122): warning: mat3x2.hpp: [jitify] File not found
glm/glm.hpp(123): warning: mat3x3.hpp: [jitify] File not found
glm/glm.hpp(124): warning: mat3x4.hpp: [jitify] File not found
glm/glm.hpp(125): warning: mat4x2.hpp: [jitify] File not found
glm/glm.hpp(126): warning: mat4x3.hpp: [jitify] File not found
glm/glm.hpp(127): warning: mat4x4.hpp: [jitify] File not found
etc

Added a breakpoint here to catch where detail::load_source() was being called.

Found these variable values

include_parent_fullpath = "C:/Users/Robadob/fgpu2/build/FLAMEGPU2/_deps/flamegpu2_visualiser-build/glm-src\\glm/glm.hpp" (Note that's an escaped \, not double)
include_path = "C:/Users/Robadob/fgpu2/build/FLAMEGPU2/_deps/flamegpu2_visualiser-build/glm-src"

This means that detail::path_base() is handling the path improperly.

The method is fairly simple

inline std::string path_base(std::string p) {
  // "/usr/local/myfile.dat" -> "/usr/local"
  // "foo/bar"  -> "foo"
  // "foo/bar/" -> "foo/bar"
#if defined _WIN32 || defined _WIN64
  char sep = '\\';
#else
  char sep = '/';
#endif
  size_t i = p.find_last_of(sep);
  if (i != std::string::npos) {
    return p.substr(0, i);
  } else {
    return "";
  }
}

Seems quite clear that it's neglecting the fact that either path separator is supported under Windows (as far as I understand).

Should be an easy fix, I'll make a PR soon.

Edit: According to people on StackOverflow, MSVC used to require backslash, but now it doesn't care. Unclear when that requirement was lifted, regardless I don't expect it will affect NVRTC.

@Robadob
Copy link
Contributor Author

Robadob commented May 13, 2021

Was attempting to test whether a kernel with GLM would build with NVRTC (I'm not hopeful).

With the fix from #88, get a bit further.

---------------------------------------------------
--- JIT compile log for inputdata_program ---
---------------------------------------------------
detail/setup.hpp(695): error: namespace "std" has no member "make_unsigned"

detail/func_common.inl(585): error: namespace "std" has no member "isnan"

detail/func_common.inl(624): error: namespace "std" has no member "isinf"

detail/func_common.inl(742): error: namespace "std" has no member "fma"

4 errors detected in the compilation of "inputdata_program".

I've managed to fix the 3 cuda math intrinsics with a small patch to GLM, that will hopefully be merged (g-truc/glm#1073).

make_unsigned is template magic from the type_traits header that Jitify probably needs to implement. This is only a low priority thing to me, so I'll try and remember to look into adding that to Jitify's type_traits shim in future (it's marked as 'highly incomplete', so won't bother with an issue).

Robadob added a commit to Robadob/jitify that referenced this issue May 17, 2021
Robadob added a commit to Robadob/jitify that referenced this issue Feb 24, 2022
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 a pull request may close this issue.

1 participant