stanford-ppl / spatial

Spatial: "Specify Parameterized Accelerators Through Inordinately Abstract Language"
https://spatial.stanford.edu
MIT License
271 stars 33 forks source link

Added support to read a text file and dump to the device memory directly #286

Closed kelayamatoz closed 4 years ago

kelayamatoz commented 4 years ago

Problem description: The existing way to load a text file into device memory is to first create a DRAM, load a file into an Array, and then setMem(...). In the case where the text file is large, e.g., text processing where a file can be >100MB, doing so leads to allocating large byte arrays on the host's stack that could cause a stack overflow. Fix in this pull request: I added a new node, loadDRAMWithASCIIText. At the host side, we don't create an Array on the stack; instead, we allocated it on the heap and delete it after memcpy-ing to the device memory. Usage: apps/src/TextFileIO.scala Others: Spatial's build.sbt could not support later versions of Java due to a bug in javax XML parser. I added one line in build.sbt to solve this issue.