26 ms·
I'd like to see the kernel figure this out automatically. If the last 100,000 files opened by grep were never accessed again, is it a good bet to cache the 10
by londons_explore 6y ago
I'd like to see the kernel figure this out automatically. If the last 100,000 files opened by grep were never accessed again, is it a good bet to cache the 100,001'st?
I think the solution is not to come up with clever heuristics, but to use a tiny neural net which predicts "how many hours till this page is accessed again?".
Train the net using a tiny sample of reads and writes.
Obviously the net needs to be really tiny to run on every single page read, but I believe even say a network with 50 weights would outperform today's heuristics.
- signa11 6y agoplease...submit patches if you can, with benchmarks as well, so that the idea can perhaps be evaluated empirically ?
- magicalhippo 6y agoIn a previous comment[1] I mentioned finding a paper that made a neural net cache predictor with seemingly great success. A key thing however was that their actual predictor was a simpler model, SVM, designed using insight discovered from the behavior of the neural network one. In particular the source address was a strong indicator for the model. [1]: https://news.ycombinator.com/item?id=26455515 https://news.ycombinator.com/item?id=26455515
- d33 6y agoMy first intuitive thought is "gosh, please, don't". It sounds like a crazy idea to integrate a neural net to everything - it might work in the 99.999% cases, but when something like this fails, good luck debugging it, re-training the network and then verifying if your improvement helped on a tight schedule. And it's also a dangerous architectural paradigm - will we end up with syscalls deciding which side effects happen deciding on whether the neural network things the file is going to be useful in the future? I don't argument for excess simplicity, but if you can't explain (critical) behavior of your code without referring to a big matrix of NN weights, it's probably a bad idea.
- magicalhippo 6y agoAs I noted in my previous comment I had a similar gut reaction. However reading the paper, for me the most interesting conclusion was this: Thus, this paper has shown how we can use deep learning in an offline setting to derive insights that lead to an improved set of features with which to make predictions for cache replacement. More broadly, our approach in designing Glider suggests that deep learning can play an important role in systematically exploring features and feature representations that can improve the effectiveness of much simpler models, such as perceptrons and SVMs.
- signa11 6y agodoes the kernel now support floating point operations ?
- magicalhippo 6y agoI'm no kernel developer so I don't know. The dataset they used for training the neural net was a recorded dataset, so training could be done offline. The specific predictor they created was integer based, so could be used in a non-floating point kernel: We then use an SVM with the k-sparse binary feature. Since integer operations are much cheaper in hardware than floating point operations, we use an Integer SVM (ISVM) with an integer margin and learning rate of 1. Again this highlights the interesting point of the paper, IMHO.
- Unklejoe 6y agoI feel like if you already know exactly how you're about to access the data, then it would be more efficient to be able to just tell the kernel rather than making it figure it out on its own. At the minimum, the first accesses would perform better since it wouldn't have to waste time learning. This is why instructions like dcbz exist on POWER - to tell it to not bother reading in the next cache line because you're about to write to it.