cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

thesmileman
Journeyman III

Kernel caching code?

Jump to solution

Does anyone have code to cache the kernel binaries and source then check for modifications before building them from scratch? I am sure someone has to have done as it takes a very long time to build kernels. It was just a hassle at first but now the time is really starting to add up when I have a chain of kernels and I change one kernel and I have to rebuild them all. Anyway I thought I would ask because I assume someone has done this and I didn't want to reinvent the wheel for such a common task plus I am sure someone has done something more robust than what I am going to write.

Would like to see this as part of the SDK. (wink, wink, wink AMD).

0 Likes
1 Solution

Accepted Solutions
notyou
Adept III

Re: Kernel caching code?

Jump to solution

Since this was just something I whipped up for my own use it's not great quality. You'll need to go over things like error checking here since I didn't include the additional files.

Note: I'm OK if anyone uses this exact (or modified) code. If you do, just send me a message since I'd like to know where it's being used (out of curiosity).

View solution in original post

0 Likes
4 Replies
notyou
Adept III

Re: Kernel caching code?

Jump to solution

I have some basic code that I use to check the binaries. I'll post it in a few hours when I get home.

0 Likes
notyou
Adept III

Re: Kernel caching code?

Jump to solution

Since this was just something I whipped up for my own use it's not great quality. You'll need to go over things like error checking here since I didn't include the additional files.

Note: I'm OK if anyone uses this exact (or modified) code. If you do, just send me a message since I'd like to know where it's being used (out of curiosity).

View solution in original post

0 Likes
thesmileman
Journeyman III

Re: Kernel caching code?

Jump to solution

@notyou,

Thanks for the code! I went through it pretty quicak and it looks great. I was thinking about saving a backup of source file and the binary so I could do a string compare rather than a modified check but I think your way here is easier and most likely the right way to go because it will be faster and that is the goal. I haven't tested it yet because I want to look it over more and see how best to add it to my framework for building and especially my framework for device selecting (getting the correct interop device can get a bit complex especially with multiple GPUs so I have a lot of code for that). .Also I usually build the kernels seperately as I have a framework for stringing together kernels but that is trivial stuff. Thanks for the awesome time saver!

0 Likes
notyou
Adept III

Re: Kernel caching code?

Jump to solution

Glad I could help. I definitely thought of using strings when I was building it but I realized that if they changed anything in the file the date modified would reflect that so we wouldn't need to look at the actual file. This in turn would handle of 99% of situations aside from any weird editing problems.

0 Likes