IFL 2012: Implementation and Application of Functional Languages pp 174-189 | Cite as
Agda Meets Accelerate
Abstract
Embedded languages in Haskell benefit from a range of type extensions, such as type families, that are subsumed by dependent types. However, even with those type extensions, embedded languages for data parallel programming lack desirable static guarantees, such as static bounds checks in indexing and collective permutation operations.
This observation raises the question whether an embedded language for data parallel programming would benefit from fully-fledged dependent types, such as those available in Agda. We explored that question by designing and implementing an Agda frontend to Accelerate, a Haskell-embedded language for data parallel programming aimed at GPUs. We discuss the potential of dependent types in this domain, describe some of the limitations that we encountered, and share some insights from our preliminary implementation.
Keywords
Programming with dependent types Data parallelismReferences
- 1.Bove, A., Dybjer, P., Norell, U.: A brief overview of agda - a functional language with dependent types. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009. LNCS, vol. 5674, pp. 73–78. Springer, Heidelberg (2009)Google Scholar
- 2.Catanzaro, B., Garland, M., Keutzer, K.: Copperhead: Compiling an embedded data parallel language. Technical Report UCB/EECS-2010-124. University of California, Berkeley (2010)Google Scholar
- 3.Chakravarty, M.M.T., Keller, G., Lee, S., McDonell, T.L., Grover, V.: Accelerating Haskell array codes with multicore GPUs. In: Carro, M., Reppy, J.H. (eds.) Workshop on Declarative Aspects of Multicore Programming, DAMP 2011, Austin, TX, USA, January 2011, pp. 3–14. ACM (2011)Google Scholar
- 4.Chakravarty, M.M.T., Keller, G., Peyton Jones, S.: Associated type synonyms. In: Pierce, B.C. (ed.) Proceedings International Conference on Functional Programming 2005, Tallinn, Estonia, September 2005, pp. 241–253. ACM Press, New York (2005)Google Scholar
- 5.Devriese, D., Piessens, F.: On the bright side of type classes: Instance arguments in Agda. In: Danvy, O. (ed.) Proceedings International Conference on Functional Programming 2011, Tokyo, Japan, September 2011, pp. 143–155. ACM Press, New York (2011)Google Scholar
- 6.Goldberg, D.: What every computer scientist should know about floating-point arithmetic. ACM Comput. Surv. 23(1), 5–48 (1991)CrossRefGoogle Scholar
- 7.Jones, S.L.P., Vytiniotis, D., Weirich, S., Washburn, G.: Simple unification-based type inference for GADTs. In: Lawall, J. (ed.) ICFP, Portland, Oregon, USA, September 2006, pp. 50–61. ACM Press, New York (2006)Google Scholar
- 8.Keller, G., Chakravarty, M.M., Leshchinskiy, R., Peyton Jones, S., Lippmeier, B.: Regular, shape-polymorphic, parallel arrays in Haskell. In: Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming, ICFP 2010. ACM (2010)Google Scholar
- 9.Martin-Löf, P.: Intuitionistic Type Theory. Bibliopolis, Napoli (1984)MATHGoogle Scholar
- 10.Norell, U.: Dependently typed programming in Agda. In: Koopman, P., Plasmeijer, R., Swierstra, D. (eds.) AFP 2008. LNCS, vol. 5832, pp. 230–266. Springer, Heidelberg (2009)Google Scholar
- 11.Peebles, D.: A dependently typed model of the Repa library in Agda. https://github.com/copumpkin/derpa (2011)
- 12.Rose, J.R., et al.: C\(^*\): An extended c language for data parallel programming. In: Proceedings of the Second International Conference on Supercomputing, pp. 2–16 (1987)Google Scholar
- 13.Saraswat, V.: Report on the programming language X10. http://dist.codehaus.org/x10/documentation/languagespec/x10-200.pdf. October 2009. Version 2.0
- 14.Schrijvers, T., Peyton Jones, S.L., Chakravarty, M.M.T., Sulzmann, M.: Type checking with open type functions. In: Thiemann, P. (ed.) Proceedings International Conference on Functional Programming 2008, Victoria, BC, Canada, October 2008, pp. 51–62. ACM Press, New York (2008)Google Scholar
- 15.Swierstra, W.: More dependent types for distributed arrays. Higher-Order Symbolic Comput., pp. 1–18 (2010)Google Scholar
- 16.Swierstra, W., Altenkirch, T.: Dependent types for distributed arrays. In: Trends in Functional Programming, vol. 9 (2008)Google Scholar
- 17.Tarditi, D., Puri, S., Oglesby, J.: Accelerator: using data parallelism to program GPUs for general-purpose uses. In: ASPLOS-XII: Proceedings of the 12th International Conference on Architectural Support for Programming Language and Operating Systems, pp. 325–335. ACM (2006)Google Scholar
- 18.Xi, H.: Dependent ML: An approach to practical programming with dependent types. J. Funct. Program. 12(2) (2007)Google Scholar
- 19.Yorgey, B.A., Weirich, S., Cretin, J., Jones, S.L.P., Vytiniotis, D., Magalhães, J.P.: Giving Haskell a promotion. In: Pierce, B.C. (ed.) Proceedings of TLDI 2012, Philadelphia, PA, USA, January 2012, pp. 53–66. ACM (2012)Google Scholar